timelock-sdk 0.0.51 → 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
@@ -36,7 +36,8 @@ const GetActiveUserOptionsDocument = gql`
36
36
  entryPrice
37
37
  expiresAt
38
38
  createdAt
39
- premiumPaid
39
+ premium
40
+ protocolFee
40
41
  realizedPayout
41
42
  marketAddr
42
43
  liquiditiesAtOpen
@@ -70,7 +71,8 @@ const GetClosedUserOptionsDocument = gql`
70
71
  entryPrice
71
72
  expiresAt
72
73
  createdAt
73
- premiumPaid
74
+ premium
75
+ protocolFee
74
76
  realizedPayout
75
77
  marketAddr
76
78
  liquiditiesAtOpen
@@ -177,10 +179,21 @@ const useTimelockConfig = () => {
177
179
  return context;
178
180
  };
179
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
+
180
192
  //#endregion
181
193
  //#region src/hooks/market/useMarketData.ts
182
194
  const useMarketData = (marketAddr) => {
183
195
  const { graphqlClient } = useTimelockConfig();
196
+ const { timelockLens } = useLens();
184
197
  const { data } = useQuery({
185
198
  queryKey: ["marketData", marketAddr || "--"],
186
199
  queryFn: async () => {
@@ -197,17 +210,18 @@ const useMarketData = (marketAddr) => {
197
210
  },
198
211
  enabled: !!marketAddr && !!graphqlClient
199
212
  });
200
- return data || {};
201
- };
202
-
203
- //#endregion
204
- //#region src/hooks/useLens.ts
205
- const useLens = () => {
206
- const client = useClient();
207
- return useMemo(() => ({
208
- timelockLens: client ? getTimelockLens(client) : void 0,
209
- uniswapLens: client ? getUniswapMathLens(client) : void 0
210
- }), [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 || {};
211
225
  };
212
226
 
213
227
  //#endregion
@@ -487,7 +501,8 @@ const useUserOptions = (user, active = false) => {
487
501
  optionType: option.optionType,
488
502
  createdAt: /* @__PURE__ */ new Date(Number(option.createdAt) * 1e3),
489
503
  expiresAt: /* @__PURE__ */ new Date(Number(option.expiresAt) * 1e3),
490
- premiumPaid: BigInt(option.premiumPaid),
504
+ premium: BigInt(option.premium),
505
+ protocolFee: BigInt(option.protocolFee),
491
506
  realizedPayout: BigInt(option.realizedPayout),
492
507
  liquiditiesAtOpen: option.liquiditiesAtOpen.map((l) => BigInt(l)),
493
508
  liquiditiesCurrent: option.liquiditiesCurrent.map((l) => BigInt(l)),