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