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 +23 -11
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +111 -111
- package/dist/client.js +23 -11
- package/dist/client.js.map +1 -1
- package/dist/{index-D_lnxPOC.d.ts → index-Dt4gerGl.d.ts} +92 -92
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
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
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
})
|
|
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
|