timelock-sdk 0.0.52 → 0.0.53

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/client.cjs CHANGED
@@ -186,10 +186,21 @@ const useTimelockConfig = () => {
186
186
  return context;
187
187
  };
188
188
 
189
+ //#endregion
190
+ //#region src/hooks/useLens.ts
191
+ const useLens = () => {
192
+ const client = (0, wagmi.useClient)();
193
+ return (0, react.useMemo)(() => ({
194
+ timelockLens: client ? require_numberUtils.getTimelockLens(client) : void 0,
195
+ uniswapLens: client ? require_numberUtils.getUniswapMathLens(client) : void 0
196
+ }), [client]);
197
+ };
198
+
189
199
  //#endregion
190
200
  //#region src/hooks/market/useMarketData.ts
191
201
  const useMarketData = (marketAddr) => {
192
202
  const { graphqlClient } = useTimelockConfig();
203
+ const { timelockLens } = useLens();
193
204
  const { data } = (0, __tanstack_react_query.useQuery)({
194
205
  queryKey: ["marketData", marketAddr || "--"],
195
206
  queryFn: async () => {
@@ -206,17 +217,18 @@ const useMarketData = (marketAddr) => {
206
217
  },
207
218
  enabled: !!marketAddr && !!graphqlClient
208
219
  });
209
- return data || {};
210
- };
211
-
212
- //#endregion
213
- //#region src/hooks/useLens.ts
214
- const useLens = () => {
215
- const client = (0, wagmi.useClient)();
216
- return (0, react.useMemo)(() => ({
217
- timelockLens: client ? require_numberUtils.getTimelockLens(client) : void 0,
218
- uniswapLens: client ? require_numberUtils.getUniswapMathLens(client) : void 0
219
- }), [client]);
220
+ const { data: fallback } = (0, __tanstack_react_query.useQuery)({
221
+ queryKey: ["marketData", marketAddr || "--"],
222
+ queryFn: async () => {
223
+ if (!marketAddr || !timelockLens) return void 0;
224
+ return {
225
+ ...await timelockLens.read.getMarketData([marketAddr]),
226
+ tradersCount: void 0
227
+ };
228
+ },
229
+ enabled: !!marketAddr && !!timelockLens
230
+ });
231
+ return data || fallback || {};
220
232
  };
221
233
 
222
234
  //#endregion