@turtleclub/hooks 0.0.1 → 0.0.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turtleclub/hooks",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
package/dist/index.cjs DELETED
@@ -1,301 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- defaultQueryClient: () => defaultQueryClient,
24
- useConfig: () => useConfig,
25
- useEarnDeals: () => useEarnDeals,
26
- useEarnRoute: () => useEarnRoute,
27
- useEarnWalletBalances: () => useEarnWalletBalances,
28
- useExists: () => useExists,
29
- useOrganizationDeals: () => useOrganizationDeals,
30
- useOrganizations: () => useOrganizations,
31
- useOrganizationsDeals: () => useOrganizationsDeals,
32
- usePrepareSignup: () => usePrepareSignup,
33
- useProjectTvl: () => useProjectTvl,
34
- useSignup: () => useSignup
35
- });
36
- module.exports = __toCommonJS(index_exports);
37
-
38
- // src/hooks/useConfig.ts
39
- var import_api = require("@turtleclub/api");
40
- function useConfig() {
41
- return import_api.defaultConfig;
42
- }
43
-
44
- // src/hooks/client.ts
45
- var import_query_sync_storage_persister = require("@tanstack/query-sync-storage-persister");
46
- var import_react_query = require("@tanstack/react-query");
47
- var import_react_query_persist_client = require("@tanstack/react-query-persist-client");
48
- var defaultQueryClient = new import_react_query.QueryClient({
49
- defaultOptions: {
50
- queries: {
51
- refetchOnWindowFocus: false
52
- }
53
- }
54
- });
55
- if (typeof window !== "undefined") {
56
- const localStoragePersister = (0, import_query_sync_storage_persister.createSyncStoragePersister)({
57
- storage: window.localStorage,
58
- key: "turtle-sdk"
59
- });
60
- (0, import_react_query_persist_client.persistQueryClient)({
61
- queryClient: defaultQueryClient,
62
- persister: localStoragePersister
63
- });
64
- }
65
-
66
- // src/hooks/endpoints/useOrganizations.ts
67
- var import_react_query2 = require("@tanstack/react-query");
68
- var import_api2 = require("@turtleclub/api");
69
- function useOrganizations({
70
- config,
71
- queryClient
72
- } = {}) {
73
- const defaultConfig2 = useConfig();
74
- const query = (0, import_react_query2.useQuery)(
75
- {
76
- queryKey: ["organizations"],
77
- queryFn: async () => {
78
- return await (0, import_api2.organization)(config ?? defaultConfig2);
79
- },
80
- staleTime: 2 * 60 * 1e3,
81
- refetchInterval: 1 * 60 * 1e3
82
- },
83
- queryClient ?? defaultQueryClient
84
- );
85
- return query;
86
- }
87
-
88
- // src/hooks/endpoints/useExists.ts
89
- var import_react_query3 = require("@tanstack/react-query");
90
- var import_api3 = require("@turtleclub/api");
91
- function useExists(options, { config, queryClient } = {}) {
92
- const defaultConfig2 = useConfig();
93
- const enabled = options !== void 0;
94
- const query = (0, import_react_query3.useQuery)({
95
- queryKey: ["exists", options?.user],
96
- queryFn: async () => {
97
- if (!enabled)
98
- return null;
99
- return await (0, import_api3.exists)(options, config ?? defaultConfig2);
100
- },
101
- enabled,
102
- staleTime: 2 * 60 * 1e3,
103
- refetchInterval: 1 * 60 * 1e3,
104
- refetchOnWindowFocus: true
105
- }, queryClient ?? defaultQueryClient);
106
- return query;
107
- }
108
-
109
- // src/hooks/endpoints/useOrganizationDeals.ts
110
- var import_react_query4 = require("@tanstack/react-query");
111
- var import_api4 = require("@turtleclub/api");
112
- function useOrganizationDeals(options, { config, queryClient } = {}) {
113
- const defaultConfig2 = useConfig();
114
- const enabled = options !== void 0;
115
- const query = (0, import_react_query4.useQuery)({
116
- queryKey: ["organizationDeals", options?.organizationId],
117
- queryFn: async () => {
118
- if (!enabled)
119
- return null;
120
- return await (0, import_api4.organizationDeals)(options, config ?? defaultConfig2);
121
- },
122
- enabled,
123
- staleTime: 2 * 60 * 1e3,
124
- refetchInterval: 1 * 60 * 1e3
125
- }, queryClient ?? defaultQueryClient);
126
- return query;
127
- }
128
-
129
- // src/hooks/endpoints/useOrganizationsDeals.ts
130
- var import_react_query5 = require("@tanstack/react-query");
131
- var import_api5 = require("@turtleclub/api");
132
- function useOrganizationsDeals(options, { config, queryClient } = {}) {
133
- const defaultConfig2 = useConfig();
134
- const enabled = options !== void 0;
135
- const query = (0, import_react_query5.useQuery)({
136
- queryKey: ["organizationsDeals", options?.organizationIds],
137
- queryFn: async () => {
138
- if (!enabled)
139
- return null;
140
- return await (0, import_api5.organizationsDeals)(options, config ?? defaultConfig2);
141
- },
142
- enabled,
143
- staleTime: 2 * 60 * 1e3,
144
- refetchInterval: 1 * 60 * 1e3,
145
- throwOnError: true
146
- }, queryClient ?? defaultQueryClient);
147
- return query;
148
- }
149
-
150
- // src/hooks/endpoints/usePrepareSignup.ts
151
- var import_react_query6 = require("@tanstack/react-query");
152
- var import_api6 = require("@turtleclub/api");
153
- function usePrepareSignup(options, { config, queryClient } = {}) {
154
- const defaultConfig2 = useConfig();
155
- const enabled = options !== void 0;
156
- const query = (0, import_react_query6.useQuery)({
157
- queryKey: ["prepareSignup", options?.user],
158
- queryFn: async () => {
159
- if (!enabled)
160
- return null;
161
- return await (0, import_api6.prepareSignup)(options, config ?? defaultConfig2);
162
- },
163
- enabled,
164
- refetchInterval: 5 * 60 * 1e3
165
- }, queryClient ?? defaultQueryClient);
166
- return query;
167
- }
168
-
169
- // src/hooks/endpoints/useProjectTvl.ts
170
- var import_react_query7 = require("@tanstack/react-query");
171
- var import_api7 = require("@turtleclub/api");
172
- function useProjectTvl(options, { config, queryClient } = {}) {
173
- const defaultConfig2 = useConfig();
174
- const enabled = options !== void 0;
175
- const query = (0, import_react_query7.useQuery)({
176
- queryKey: ["projectTvl", options?.projects],
177
- queryFn: async () => {
178
- if (!enabled)
179
- return null;
180
- return await (0, import_api7.projectTvl)(options, config ?? defaultConfig2);
181
- },
182
- enabled,
183
- staleTime: 7 * 60 * 1e3,
184
- refetchInterval: 5 * 60 * 1e3
185
- }, queryClient ?? defaultQueryClient);
186
- return query;
187
- }
188
-
189
- // src/hooks/endpoints/useSignup.ts
190
- var import_react_query8 = require("@tanstack/react-query");
191
- var import_api8 = require("@turtleclub/api");
192
- function useSignup(options, { config, queryClient } = {}) {
193
- const defaultConfig2 = useConfig();
194
- const enabled = options !== void 0;
195
- const mutation = (0, import_react_query8.useMutation)(
196
- {
197
- mutationFn: async (signature) => {
198
- if (!enabled) return null;
199
- return await (0, import_api8.signup)({ ...options, signature }, config ?? defaultConfig2);
200
- }
201
- },
202
- queryClient ?? defaultQueryClient
203
- );
204
- return mutation;
205
- }
206
-
207
- // src/hooks/endpoints/earn/useDeals.ts
208
- var import_react_query9 = require("@tanstack/react-query");
209
- var import_api9 = require("@turtleclub/api");
210
- function useEarnDeals(options, { config, queryClient } = {}) {
211
- const defaultConfig2 = useConfig();
212
- const enabled = options !== void 0;
213
- const query = (0, import_react_query9.useQuery)({
214
- queryKey: [
215
- "earn-deals",
216
- options?.campaignId,
217
- options?.idFilter,
218
- options?.protocolFilter
219
- ],
220
- queryFn: async () => {
221
- if (!enabled)
222
- return null;
223
- return await (0, import_api9.earnDeals)(options, config ?? defaultConfig2);
224
- },
225
- enabled,
226
- staleTime: 60 * 1e3,
227
- refetchInterval: 30 * 1e3,
228
- refetchOnWindowFocus: true
229
- }, queryClient ?? defaultQueryClient);
230
- return query;
231
- }
232
-
233
- // src/hooks/endpoints/earn/useRoute.ts
234
- var import_react_query10 = require("@tanstack/react-query");
235
- var import_api10 = require("@turtleclub/api");
236
- function useEarnRoute(options, { config, queryClient } = {}) {
237
- const defaultConfig2 = useConfig();
238
- const enabled = options !== void 0;
239
- const query = (0, import_react_query10.useQuery)({
240
- queryKey: [
241
- "earnRoute",
242
- options?.user,
243
- options?.chain,
244
- options?.slippage,
245
- options?.tokenIn,
246
- options?.tokenOut,
247
- options?.amount
248
- ],
249
- queryFn: async () => {
250
- if (!enabled)
251
- return null;
252
- return await (0, import_api10.earnRoute)(options, config ?? defaultConfig2);
253
- },
254
- enabled,
255
- staleTime: 2 * 60 * 1e3,
256
- // 2 minutes - longer stale time for transaction stability
257
- refetchInterval: false,
258
- // Disable automatic refetch to prevent transaction state reset
259
- refetchOnWindowFocus: true
260
- }, queryClient ?? defaultQueryClient);
261
- return query;
262
- }
263
-
264
- // src/hooks/endpoints/earn/useWalletBalances.ts
265
- var import_react_query11 = require("@tanstack/react-query");
266
- var import_api11 = require("@turtleclub/api");
267
- function useEarnWalletBalances(options, { config, queryClient } = {}) {
268
- const defaultConfig2 = useConfig();
269
- const enabled = options !== void 0;
270
- const query = (0, import_react_query11.useQuery)(
271
- {
272
- queryKey: ["earnWalletBalances", options?.chain, options?.user],
273
- queryFn: async () => {
274
- if (!enabled) return null;
275
- return await (0, import_api11.earnWalletBalances)(options, config ?? defaultConfig2);
276
- },
277
- enabled,
278
- staleTime: 30 * 1e3,
279
- refetchInterval: 15 * 1e3,
280
- refetchOnWindowFocus: true
281
- },
282
- queryClient ?? defaultQueryClient
283
- );
284
- return query;
285
- }
286
- // Annotate the CommonJS export names for ESM import in node:
287
- 0 && (module.exports = {
288
- defaultQueryClient,
289
- useConfig,
290
- useEarnDeals,
291
- useEarnRoute,
292
- useEarnWalletBalances,
293
- useExists,
294
- useOrganizationDeals,
295
- useOrganizations,
296
- useOrganizationsDeals,
297
- usePrepareSignup,
298
- useProjectTvl,
299
- useSignup
300
- });
301
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/hooks/useConfig.ts","../src/hooks/client.ts","../src/hooks/endpoints/useOrganizations.ts","../src/hooks/endpoints/useExists.ts","../src/hooks/endpoints/useOrganizationDeals.ts","../src/hooks/endpoints/useOrganizationsDeals.ts","../src/hooks/endpoints/usePrepareSignup.ts","../src/hooks/endpoints/useProjectTvl.ts","../src/hooks/endpoints/useSignup.ts","../src/hooks/endpoints/earn/useDeals.ts","../src/hooks/endpoints/earn/useRoute.ts","../src/hooks/endpoints/earn/useWalletBalances.ts"],"sourcesContent":["// Hooks\nexport * from \"./hooks/useConfig\";\nexport * from \"./hooks/client\";\n\n// Endpoint hooks\nexport * from \"./hooks/endpoints/useOrganizations\";\nexport * from \"./hooks/endpoints/useExists\";\nexport * from \"./hooks/endpoints/useOrganizationDeals\";\nexport * from \"./hooks/endpoints/useOrganizationsDeals\";\nexport * from \"./hooks/endpoints/usePrepareSignup\";\nexport * from \"./hooks/endpoints/useProjectTvl\";\nexport * from \"./hooks/endpoints/useSignup\";\n\n// Earn hooks\nexport * from \"./hooks/endpoints/earn\";\n","import type { Config } from \"@turtleclub/api\";\nimport { defaultConfig } from \"@turtleclub/api\";\n\nexport function useConfig(): Config {\n // Placeholder implementation - in real app this would use TurtleProvider context\n return defaultConfig;\n}\n","import { createSyncStoragePersister } from \"@tanstack/query-sync-storage-persister\";\nimport { QueryClient } from \"@tanstack/react-query\";\nimport { persistQueryClient } from \"@tanstack/react-query-persist-client\";\n\nexport const defaultQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n refetchOnWindowFocus: false,\n },\n },\n});\n\n// Only persist on client side\nif (typeof window !== 'undefined') {\n const localStoragePersister = createSyncStoragePersister({\n storage: window.localStorage,\n key: \"turtle-sdk\",\n });\n\n persistQueryClient({\n queryClient: defaultQueryClient,\n persister: localStoragePersister,\n });\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, organization, type OrganizationResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseOrganizationsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useOrganizations({\n config,\n queryClient,\n}: UseOrganizationsOptions = {}): UseQueryResult<OrganizationResponse | null> {\n const defaultConfig = useConfig();\n\n const query = useQuery(\n {\n queryKey: [\"organizations\"],\n queryFn: async () => {\n return await organization(config ?? defaultConfig);\n },\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n },\n queryClient ?? defaultQueryClient\n );\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, exists, type ExistsOptions } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseExistsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useExists(\n options?: ExistsOptions,\n { config, queryClient }: UseExistsOptions = {},\n): UseQueryResult<boolean | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"exists\", options?.user],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await exists(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n refetchOnWindowFocus: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, organizationDeals, type OrganizationDealsOptions, type OrganizationDealsResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseOrganizationDealsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useOrganizationDeals(\n options?: OrganizationDealsOptions,\n { config, queryClient }: UseOrganizationDealsOptions = {},\n): UseQueryResult<OrganizationDealsResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"organizationDeals\", options?.organizationId],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await organizationDeals(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, organizationsDeals, type OrganizationsDealsOptions, type OrganizationsDealsResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseOrganizationsDealsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useOrganizationsDeals(\n options?: OrganizationsDealsOptions,\n { config, queryClient }: UseOrganizationsDealsOptions = {},\n): UseQueryResult<OrganizationsDealsResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"organizationsDeals\", options?.organizationIds],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await organizationsDeals(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n throwOnError: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, prepareSignup, type PrepareSignupOptions, type PrepareSignupResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UsePrepareSignupOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function usePrepareSignup(\n options?: PrepareSignupOptions,\n { config, queryClient }: UsePrepareSignupOptions = {},\n): UseQueryResult<PrepareSignupResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"prepareSignup\", options?.user],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await prepareSignup(options, config ?? defaultConfig);\n },\n enabled,\n refetchInterval: 5 * 60 * 1000,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, projectTvl, type ProjectTvlOptions, type ProjectTvlResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseProjectTvlOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useProjectTvl(\n options?: ProjectTvlOptions,\n { config, queryClient }: UseProjectTvlOptions = {},\n): UseQueryResult<ProjectTvlResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"projectTvl\", options?.projects],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await projectTvl(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 7 * 60 * 1000,\n refetchInterval: 5 * 60 * 1000,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import {\n type QueryClient,\n useMutation,\n type UseMutationResult,\n useQuery,\n} from \"@tanstack/react-query\";\nimport { type Config, signup, type SignupOptions } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseSignupOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useSignup(\n options?: Omit<SignupOptions, \"signature\">,\n { config, queryClient }: UseSignupOptions = {}\n): UseMutationResult<boolean | null, Error, string, unknown> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const mutation = useMutation(\n {\n mutationFn: async (signature: string) => {\n if (!enabled) return null;\n\n return await signup({ ...options, signature }, config ?? defaultConfig);\n },\n },\n queryClient ?? defaultQueryClient\n );\n\n return mutation;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, earnDeals, type EarnDealsOptions, type EarnDealsResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"@/hooks/client\";\nimport { useConfig } from \"@/hooks/useConfig\";\n\nexport interface UseEarnDealsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useEarnDeals(\n options?: EarnDealsOptions,\n { config, queryClient }: UseEarnDealsOptions = {},\n): UseQueryResult<EarnDealsResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\n \"earn-deals\",\n options?.campaignId,\n options?.idFilter,\n options?.protocolFilter,\n ],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await earnDeals(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 60 * 1000,\n refetchInterval: 30 * 1000,\n refetchOnWindowFocus: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, earnRoute, type EarnRouteOptions, type EarnRouteResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../../client\";\nimport { useConfig } from \"../../useConfig\";\n\nexport interface UseEarnRouteOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useEarnRoute(\n options?: EarnRouteOptions,\n { config, queryClient }: UseEarnRouteOptions = {},\n): UseQueryResult<EarnRouteResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\n \"earnRoute\",\n options?.user,\n options?.chain,\n options?.slippage,\n options?.tokenIn,\n options?.tokenOut,\n options?.amount,\n ],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await earnRoute(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000, // 2 minutes - longer stale time for transaction stability\n refetchInterval: false, // Disable automatic refetch to prevent transaction state reset\n refetchOnWindowFocus: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport {\n type Config,\n earnWalletBalances,\n type EarnWalletBalancesOptions,\n type EarnWalletBalancesResponse,\n} from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../../client\";\nimport { useConfig } from \"../../useConfig\";\n\nexport interface UseEarnWalletBalancesOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useEarnWalletBalances(\n options?: EarnWalletBalancesOptions,\n { config, queryClient }: UseEarnWalletBalancesOptions = {}\n): UseQueryResult<EarnWalletBalancesResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery(\n {\n queryKey: [\"earnWalletBalances\", options?.chain, options?.user],\n queryFn: async () => {\n if (!enabled) return null;\n\n return await earnWalletBalances(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 30 * 1000,\n refetchInterval: 15 * 1000,\n refetchOnWindowFocus: true,\n },\n queryClient ?? defaultQueryClient\n );\n\n return query;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,iBAA8B;AAEvB,SAAS,YAAoB;AAElC,SAAO;AACT;;;ACNA,0CAA2C;AAC3C,yBAA4B;AAC5B,wCAAmC;AAE5B,IAAM,qBAAqB,IAAI,+BAAY;AAAA,EAChD,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,sBAAsB;AAAA,IACxB;AAAA,EACF;AACF,CAAC;AAGD,IAAI,OAAO,WAAW,aAAa;AACjC,QAAM,4BAAwB,gEAA2B;AAAA,IACvD,SAAS,OAAO;AAAA,IAChB,KAAK;AAAA,EACP,CAAC;AAED,4DAAmB;AAAA,IACjB,aAAa;AAAA,IACb,WAAW;AAAA,EACb,CAAC;AACH;;;ACvBA,IAAAA,sBAAgE;AAChE,IAAAC,cAAqE;AAS9D,SAAS,iBAAiB;A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M,UAAU,YAAY;AAE5B,QAAM,YAAQ,+BAAS;AAAA,IACrB,UAAU;AAAA,MACR;AAAA,MACA,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,IACA,SAAS,YAAY;AACnB,UAAI,CAAC;AACH,eAAO;AAET,aAAO,UAAM,wBAAU,SAAS,UAAUA,cAAa;AAAA,IACzD;AAAA,IACA;AAAA,IACA,WAAW,IAAI,KAAK;AAAA;AAAA,IACpB,iBAAiB;AAAA;AAAA,IACjB,sBAAsB;AAAA,EACxB,GAAG,eAAe,kBAAkB;AAEpC,SAAO;AACT;;;ACxCA,IAAAC,uBAAgE;AAChE,IAAAC,eAKO;AASA,SAAS,sBACd,SACA,EAAE,QAAQ,YAAY,IAAkC,CAAC,GACN;AACnD,QAAMC,iBAAgB,UAAU;AAChC,QAAM,UAAU,YAAY;AAE5B,QAAM,YAAQ;AAAA,IACZ;AAAA,MACE,UAAU,CAAC,sBAAsB,SAAS,OAAO,SAAS,IAAI;AAAA,MAC9D,SAAS,YAAY;AACnB,YAAI,CAAC,QAAS,QAAO;AAErB,eAAO,UAAM,iCAAmB,SAAS,UAAUA,cAAa;AAAA,MAClE;AAAA,MACA;AAAA,MACA,WAAW,KAAK;AAAA,MAChB,iBAAiB,KAAK;AAAA,MACtB,sBAAsB;AAAA,IACxB;AAAA,IACA,eAAe;AAAA,EACjB;AAEA,SAAO;AACT;","names":["import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig","import_react_query","import_api","defaultConfig"]}
package/dist/index.js DELETED
@@ -1,267 +0,0 @@
1
- // src/hooks/useConfig.ts
2
- import { defaultConfig } from "@turtleclub/api";
3
- function useConfig() {
4
- return defaultConfig;
5
- }
6
-
7
- // src/hooks/client.ts
8
- import { createSyncStoragePersister } from "@tanstack/query-sync-storage-persister";
9
- import { QueryClient } from "@tanstack/react-query";
10
- import { persistQueryClient } from "@tanstack/react-query-persist-client";
11
- var defaultQueryClient = new QueryClient({
12
- defaultOptions: {
13
- queries: {
14
- refetchOnWindowFocus: false
15
- }
16
- }
17
- });
18
- if (typeof window !== "undefined") {
19
- const localStoragePersister = createSyncStoragePersister({
20
- storage: window.localStorage,
21
- key: "turtle-sdk"
22
- });
23
- persistQueryClient({
24
- queryClient: defaultQueryClient,
25
- persister: localStoragePersister
26
- });
27
- }
28
-
29
- // src/hooks/endpoints/useOrganizations.ts
30
- import { useQuery } from "@tanstack/react-query";
31
- import { organization } from "@turtleclub/api";
32
- function useOrganizations({
33
- config,
34
- queryClient
35
- } = {}) {
36
- const defaultConfig2 = useConfig();
37
- const query = useQuery(
38
- {
39
- queryKey: ["organizations"],
40
- queryFn: async () => {
41
- return await organization(config ?? defaultConfig2);
42
- },
43
- staleTime: 2 * 60 * 1e3,
44
- refetchInterval: 1 * 60 * 1e3
45
- },
46
- queryClient ?? defaultQueryClient
47
- );
48
- return query;
49
- }
50
-
51
- // src/hooks/endpoints/useExists.ts
52
- import { useQuery as useQuery2 } from "@tanstack/react-query";
53
- import { exists } from "@turtleclub/api";
54
- function useExists(options, { config, queryClient } = {}) {
55
- const defaultConfig2 = useConfig();
56
- const enabled = options !== void 0;
57
- const query = useQuery2({
58
- queryKey: ["exists", options?.user],
59
- queryFn: async () => {
60
- if (!enabled)
61
- return null;
62
- return await exists(options, config ?? defaultConfig2);
63
- },
64
- enabled,
65
- staleTime: 2 * 60 * 1e3,
66
- refetchInterval: 1 * 60 * 1e3,
67
- refetchOnWindowFocus: true
68
- }, queryClient ?? defaultQueryClient);
69
- return query;
70
- }
71
-
72
- // src/hooks/endpoints/useOrganizationDeals.ts
73
- import { useQuery as useQuery3 } from "@tanstack/react-query";
74
- import { organizationDeals } from "@turtleclub/api";
75
- function useOrganizationDeals(options, { config, queryClient } = {}) {
76
- const defaultConfig2 = useConfig();
77
- const enabled = options !== void 0;
78
- const query = useQuery3({
79
- queryKey: ["organizationDeals", options?.organizationId],
80
- queryFn: async () => {
81
- if (!enabled)
82
- return null;
83
- return await organizationDeals(options, config ?? defaultConfig2);
84
- },
85
- enabled,
86
- staleTime: 2 * 60 * 1e3,
87
- refetchInterval: 1 * 60 * 1e3
88
- }, queryClient ?? defaultQueryClient);
89
- return query;
90
- }
91
-
92
- // src/hooks/endpoints/useOrganizationsDeals.ts
93
- import { useQuery as useQuery4 } from "@tanstack/react-query";
94
- import { organizationsDeals } from "@turtleclub/api";
95
- function useOrganizationsDeals(options, { config, queryClient } = {}) {
96
- const defaultConfig2 = useConfig();
97
- const enabled = options !== void 0;
98
- const query = useQuery4({
99
- queryKey: ["organizationsDeals", options?.organizationIds],
100
- queryFn: async () => {
101
- if (!enabled)
102
- return null;
103
- return await organizationsDeals(options, config ?? defaultConfig2);
104
- },
105
- enabled,
106
- staleTime: 2 * 60 * 1e3,
107
- refetchInterval: 1 * 60 * 1e3,
108
- throwOnError: true
109
- }, queryClient ?? defaultQueryClient);
110
- return query;
111
- }
112
-
113
- // src/hooks/endpoints/usePrepareSignup.ts
114
- import { useQuery as useQuery5 } from "@tanstack/react-query";
115
- import { prepareSignup } from "@turtleclub/api";
116
- function usePrepareSignup(options, { config, queryClient } = {}) {
117
- const defaultConfig2 = useConfig();
118
- const enabled = options !== void 0;
119
- const query = useQuery5({
120
- queryKey: ["prepareSignup", options?.user],
121
- queryFn: async () => {
122
- if (!enabled)
123
- return null;
124
- return await prepareSignup(options, config ?? defaultConfig2);
125
- },
126
- enabled,
127
- refetchInterval: 5 * 60 * 1e3
128
- }, queryClient ?? defaultQueryClient);
129
- return query;
130
- }
131
-
132
- // src/hooks/endpoints/useProjectTvl.ts
133
- import { useQuery as useQuery6 } from "@tanstack/react-query";
134
- import { projectTvl } from "@turtleclub/api";
135
- function useProjectTvl(options, { config, queryClient } = {}) {
136
- const defaultConfig2 = useConfig();
137
- const enabled = options !== void 0;
138
- const query = useQuery6({
139
- queryKey: ["projectTvl", options?.projects],
140
- queryFn: async () => {
141
- if (!enabled)
142
- return null;
143
- return await projectTvl(options, config ?? defaultConfig2);
144
- },
145
- enabled,
146
- staleTime: 7 * 60 * 1e3,
147
- refetchInterval: 5 * 60 * 1e3
148
- }, queryClient ?? defaultQueryClient);
149
- return query;
150
- }
151
-
152
- // src/hooks/endpoints/useSignup.ts
153
- import {
154
- useMutation
155
- } from "@tanstack/react-query";
156
- import { signup } from "@turtleclub/api";
157
- function useSignup(options, { config, queryClient } = {}) {
158
- const defaultConfig2 = useConfig();
159
- const enabled = options !== void 0;
160
- const mutation = useMutation(
161
- {
162
- mutationFn: async (signature) => {
163
- if (!enabled) return null;
164
- return await signup({ ...options, signature }, config ?? defaultConfig2);
165
- }
166
- },
167
- queryClient ?? defaultQueryClient
168
- );
169
- return mutation;
170
- }
171
-
172
- // src/hooks/endpoints/earn/useDeals.ts
173
- import { useQuery as useQuery8 } from "@tanstack/react-query";
174
- import { earnDeals } from "@turtleclub/api";
175
- function useEarnDeals(options, { config, queryClient } = {}) {
176
- const defaultConfig2 = useConfig();
177
- const enabled = options !== void 0;
178
- const query = useQuery8({
179
- queryKey: [
180
- "earn-deals",
181
- options?.campaignId,
182
- options?.idFilter,
183
- options?.protocolFilter
184
- ],
185
- queryFn: async () => {
186
- if (!enabled)
187
- return null;
188
- return await earnDeals(options, config ?? defaultConfig2);
189
- },
190
- enabled,
191
- staleTime: 60 * 1e3,
192
- refetchInterval: 30 * 1e3,
193
- refetchOnWindowFocus: true
194
- }, queryClient ?? defaultQueryClient);
195
- return query;
196
- }
197
-
198
- // src/hooks/endpoints/earn/useRoute.ts
199
- import { useQuery as useQuery9 } from "@tanstack/react-query";
200
- import { earnRoute } from "@turtleclub/api";
201
- function useEarnRoute(options, { config, queryClient } = {}) {
202
- const defaultConfig2 = useConfig();
203
- const enabled = options !== void 0;
204
- const query = useQuery9({
205
- queryKey: [
206
- "earnRoute",
207
- options?.user,
208
- options?.chain,
209
- options?.slippage,
210
- options?.tokenIn,
211
- options?.tokenOut,
212
- options?.amount
213
- ],
214
- queryFn: async () => {
215
- if (!enabled)
216
- return null;
217
- return await earnRoute(options, config ?? defaultConfig2);
218
- },
219
- enabled,
220
- staleTime: 2 * 60 * 1e3,
221
- // 2 minutes - longer stale time for transaction stability
222
- refetchInterval: false,
223
- // Disable automatic refetch to prevent transaction state reset
224
- refetchOnWindowFocus: true
225
- }, queryClient ?? defaultQueryClient);
226
- return query;
227
- }
228
-
229
- // src/hooks/endpoints/earn/useWalletBalances.ts
230
- import { useQuery as useQuery10 } from "@tanstack/react-query";
231
- import {
232
- earnWalletBalances
233
- } from "@turtleclub/api";
234
- function useEarnWalletBalances(options, { config, queryClient } = {}) {
235
- const defaultConfig2 = useConfig();
236
- const enabled = options !== void 0;
237
- const query = useQuery10(
238
- {
239
- queryKey: ["earnWalletBalances", options?.chain, options?.user],
240
- queryFn: async () => {
241
- if (!enabled) return null;
242
- return await earnWalletBalances(options, config ?? defaultConfig2);
243
- },
244
- enabled,
245
- staleTime: 30 * 1e3,
246
- refetchInterval: 15 * 1e3,
247
- refetchOnWindowFocus: true
248
- },
249
- queryClient ?? defaultQueryClient
250
- );
251
- return query;
252
- }
253
- export {
254
- defaultQueryClient,
255
- useConfig,
256
- useEarnDeals,
257
- useEarnRoute,
258
- useEarnWalletBalances,
259
- useExists,
260
- useOrganizationDeals,
261
- useOrganizations,
262
- useOrganizationsDeals,
263
- usePrepareSignup,
264
- useProjectTvl,
265
- useSignup
266
- };
267
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/useConfig.ts","../src/hooks/client.ts","../src/hooks/endpoints/useOrganizations.ts","../src/hooks/endpoints/useExists.ts","../src/hooks/endpoints/useOrganizationDeals.ts","../src/hooks/endpoints/useOrganizationsDeals.ts","../src/hooks/endpoints/usePrepareSignup.ts","../src/hooks/endpoints/useProjectTvl.ts","../src/hooks/endpoints/useSignup.ts","../src/hooks/endpoints/earn/useDeals.ts","../src/hooks/endpoints/earn/useRoute.ts","../src/hooks/endpoints/earn/useWalletBalances.ts"],"sourcesContent":["import type { Config } from \"@turtleclub/api\";\nimport { defaultConfig } from \"@turtleclub/api\";\n\nexport function useConfig(): Config {\n // Placeholder implementation - in real app this would use TurtleProvider context\n return defaultConfig;\n}\n","import { createSyncStoragePersister } from \"@tanstack/query-sync-storage-persister\";\nimport { QueryClient } from \"@tanstack/react-query\";\nimport { persistQueryClient } from \"@tanstack/react-query-persist-client\";\n\nexport const defaultQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n refetchOnWindowFocus: false,\n },\n },\n});\n\n// Only persist on client side\nif (typeof window !== 'undefined') {\n const localStoragePersister = createSyncStoragePersister({\n storage: window.localStorage,\n key: \"turtle-sdk\",\n });\n\n persistQueryClient({\n queryClient: defaultQueryClient,\n persister: localStoragePersister,\n });\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, organization, type OrganizationResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseOrganizationsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useOrganizations({\n config,\n queryClient,\n}: UseOrganizationsOptions = {}): UseQueryResult<OrganizationResponse | null> {\n const defaultConfig = useConfig();\n\n const query = useQuery(\n {\n queryKey: [\"organizations\"],\n queryFn: async () => {\n return await organization(config ?? defaultConfig);\n },\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n },\n queryClient ?? defaultQueryClient\n );\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, exists, type ExistsOptions } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseExistsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useExists(\n options?: ExistsOptions,\n { config, queryClient }: UseExistsOptions = {},\n): UseQueryResult<boolean | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"exists\", options?.user],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await exists(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n refetchOnWindowFocus: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, organizationDeals, type OrganizationDealsOptions, type OrganizationDealsResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseOrganizationDealsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useOrganizationDeals(\n options?: OrganizationDealsOptions,\n { config, queryClient }: UseOrganizationDealsOptions = {},\n): UseQueryResult<OrganizationDealsResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"organizationDeals\", options?.organizationId],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await organizationDeals(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, organizationsDeals, type OrganizationsDealsOptions, type OrganizationsDealsResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseOrganizationsDealsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useOrganizationsDeals(\n options?: OrganizationsDealsOptions,\n { config, queryClient }: UseOrganizationsDealsOptions = {},\n): UseQueryResult<OrganizationsDealsResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"organizationsDeals\", options?.organizationIds],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await organizationsDeals(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000,\n refetchInterval: 1 * 60 * 1000,\n throwOnError: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, prepareSignup, type PrepareSignupOptions, type PrepareSignupResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UsePrepareSignupOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function usePrepareSignup(\n options?: PrepareSignupOptions,\n { config, queryClient }: UsePrepareSignupOptions = {},\n): UseQueryResult<PrepareSignupResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"prepareSignup\", options?.user],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await prepareSignup(options, config ?? defaultConfig);\n },\n enabled,\n refetchInterval: 5 * 60 * 1000,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, projectTvl, type ProjectTvlOptions, type ProjectTvlResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseProjectTvlOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useProjectTvl(\n options?: ProjectTvlOptions,\n { config, queryClient }: UseProjectTvlOptions = {},\n): UseQueryResult<ProjectTvlResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\"projectTvl\", options?.projects],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await projectTvl(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 7 * 60 * 1000,\n refetchInterval: 5 * 60 * 1000,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import {\n type QueryClient,\n useMutation,\n type UseMutationResult,\n useQuery,\n} from \"@tanstack/react-query\";\nimport { type Config, signup, type SignupOptions } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../client\";\nimport { useConfig } from \"../useConfig\";\n\nexport interface UseSignupOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useSignup(\n options?: Omit<SignupOptions, \"signature\">,\n { config, queryClient }: UseSignupOptions = {}\n): UseMutationResult<boolean | null, Error, string, unknown> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const mutation = useMutation(\n {\n mutationFn: async (signature: string) => {\n if (!enabled) return null;\n\n return await signup({ ...options, signature }, config ?? defaultConfig);\n },\n },\n queryClient ?? defaultQueryClient\n );\n\n return mutation;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, earnDeals, type EarnDealsOptions, type EarnDealsResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"@/hooks/client\";\nimport { useConfig } from \"@/hooks/useConfig\";\n\nexport interface UseEarnDealsOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useEarnDeals(\n options?: EarnDealsOptions,\n { config, queryClient }: UseEarnDealsOptions = {},\n): UseQueryResult<EarnDealsResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\n \"earn-deals\",\n options?.campaignId,\n options?.idFilter,\n options?.protocolFilter,\n ],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await earnDeals(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 60 * 1000,\n refetchInterval: 30 * 1000,\n refetchOnWindowFocus: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { type Config, earnRoute, type EarnRouteOptions, type EarnRouteResponse } from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../../client\";\nimport { useConfig } from \"../../useConfig\";\n\nexport interface UseEarnRouteOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useEarnRoute(\n options?: EarnRouteOptions,\n { config, queryClient }: UseEarnRouteOptions = {},\n): UseQueryResult<EarnRouteResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery({\n queryKey: [\n \"earnRoute\",\n options?.user,\n options?.chain,\n options?.slippage,\n options?.tokenIn,\n options?.tokenOut,\n options?.amount,\n ],\n queryFn: async () => {\n if (!enabled)\n return null;\n\n return await earnRoute(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 2 * 60 * 1000, // 2 minutes - longer stale time for transaction stability\n refetchInterval: false, // Disable automatic refetch to prevent transaction state reset\n refetchOnWindowFocus: true,\n }, queryClient ?? defaultQueryClient);\n\n return query;\n}\n","import { type QueryClient, useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport {\n type Config,\n earnWalletBalances,\n type EarnWalletBalancesOptions,\n type EarnWalletBalancesResponse,\n} from \"@turtleclub/api\";\nimport { defaultQueryClient } from \"../../client\";\nimport { useConfig } from \"../../useConfig\";\n\nexport interface UseEarnWalletBalancesOptions {\n config?: Config;\n queryClient?: QueryClient;\n}\n\nexport function useEarnWalletBalances(\n options?: EarnWalletBalancesOptions,\n { config, queryClient }: UseEarnWalletBalancesOptions = {}\n): UseQueryResult<EarnWalletBalancesResponse | null> {\n const defaultConfig = useConfig();\n const enabled = options !== undefined;\n\n const query = useQuery(\n {\n queryKey: [\"earnWalletBalances\", options?.chain, options?.user],\n queryFn: async () => {\n if (!enabled) return null;\n\n return await earnWalletBalances(options, config ?? defaultConfig);\n },\n enabled,\n staleTime: 30 * 1000,\n refetchInterval: 15 * 1000,\n refetchOnWindowFocus: true,\n },\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,IACZ;AAAA,MACE,UAAU,CAAC,sBAAsB,SAAS,OAAO,SAAS,IAAI;AAAA,MAC9D,SAAS,YAAY;AACnB,YAAI,CAAC,QAAS,QAAO;AAErB,eAAO,MAAM,mBAAmB,SAAS,UAAUD,cAAa;AAAA,MAClE;AAAA,MACA;AAAA,MACA,WAAW,KAAK;AAAA,MAChB,iBAAiB,KAAK;AAAA,MACtB,sBAAsB;AAAA,IACxB;AAAA,IACA,eAAe;AAAA,EACjB;AAEA,SAAO;AACT;","names":["defaultConfig","useQuery","defaultConfig","useQuery","useQuery","defaultConfig","useQuery","useQuery","defaultConfig","useQuery","useQuery","defaultConfig","useQuery","useQuery","defaultConfig","useQuery","defaultConfig","useQuery","defaultConfig","useQuery","useQuery","defaultConfig","useQuery","useQuery","defaultConfig","useQuery"]}