timelock-sdk 0.0.234 → 0.0.235

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
@@ -127,7 +127,23 @@ const GetMarketVolumeDocument = graphql_tag.default`
127
127
  tradersCount
128
128
  totalVolume
129
129
  totalPremium
130
- totalProfit
130
+ totalPayout
131
+ totalProtocolFee
132
+ }
133
+ }
134
+ `;
135
+ const GetMarketDailyVolumeDocument = graphql_tag.default`
136
+ query GetMarketDailyVolume($marketAddr: String!) {
137
+ MarketDailyData(
138
+ where: {market: {address: {_eq: $marketAddr}}}
139
+ order_by: {date: asc}
140
+ ) {
141
+ id
142
+ date
143
+ totalVolume
144
+ totalPremium
145
+ totalPayout
146
+ totalProtocolFee
131
147
  }
132
148
  }
133
149
  `;
@@ -139,8 +155,9 @@ const GetMarketUserVolumeDocument = graphql_tag.default`
139
155
  ) {
140
156
  address
141
157
  totalVolume
142
- totalProfit
158
+ totalPayout
143
159
  totalPremium
160
+ totalProtocolFee
144
161
  optionsCount
145
162
  }
146
163
  }
@@ -200,7 +217,6 @@ const GetOptionEventsDocument = graphql_tag.default`
200
217
  ) {
201
218
  id
202
219
  liquidities
203
- price
204
220
  payout
205
221
  timestamp
206
222
  blockNumber
@@ -295,6 +311,17 @@ function getSdk$1(client, withWrapper = defaultWrapper$1) {
295
311
  signal
296
312
  }), "GetMarketVolume", "query", variables);
297
313
  },
314
+ GetMarketDailyVolume(variables, requestHeaders, signal) {
315
+ return withWrapper((wrappedRequestHeaders) => client.request({
316
+ document: GetMarketDailyVolumeDocument,
317
+ variables,
318
+ requestHeaders: {
319
+ ...requestHeaders,
320
+ ...wrappedRequestHeaders
321
+ },
322
+ signal
323
+ }), "GetMarketDailyVolume", "query", variables);
324
+ },
298
325
  GetMarketUserVolume(variables, requestHeaders, signal) {
299
326
  return withWrapper((wrappedRequestHeaders) => client.request({
300
327
  document: GetMarketUserVolumeDocument,
@@ -775,7 +802,7 @@ const useMarketVolume = (marketAddr) => {
775
802
  address: result.TimelockMarket[0].address,
776
803
  totalVolume: BigInt(result.TimelockMarket[0].totalVolume),
777
804
  totalPremium: BigInt(result.TimelockMarket[0].totalPremium),
778
- totalProfit: BigInt(result.TimelockMarket[0].totalProfit),
805
+ totalPayout: BigInt(result.TimelockMarket[0].totalPayout),
779
806
  optionsCount: BigInt(result.TimelockMarket[0].optionsCount),
780
807
  tradersCount: BigInt(result.TimelockMarket[0].tradersCount)
781
808
  };
@@ -803,7 +830,7 @@ const useMarketUserVolume = (marketAddr, userAddr) => {
803
830
  address: result.TimelockMarketUser[0].address,
804
831
  totalVolume: BigInt(result.TimelockMarketUser[0].totalVolume),
805
832
  totalPremium: BigInt(result.TimelockMarketUser[0].totalPremium),
806
- totalProfit: BigInt(result.TimelockMarketUser[0].totalProfit),
833
+ totalPayout: BigInt(result.TimelockMarketUser[0].totalPayout),
807
834
  optionsCount: BigInt(result.TimelockMarketUser[0].optionsCount)
808
835
  };
809
836
  },
@@ -837,6 +864,25 @@ const useUpdateMarketBounds = (marketAddr) => {
837
864
  };
838
865
  };
839
866
 
867
+ //#endregion
868
+ //#region src/hooks/market/useMarketDailyVolume.ts
869
+ const useMarketDailyVolume = (marketAddr) => {
870
+ const { timelockGraphqlClient } = useTimelockConfig();
871
+ return (0, _tanstack_react_query.useQuery)({
872
+ queryKey: ["marketDailyData", (marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase()) || "--"],
873
+ queryFn: async () => {
874
+ return (await timelockGraphqlClient.GetMarketDailyVolume({ marketAddr: marketAddr.toLowerCase() })).MarketDailyData.map((data) => ({
875
+ id: data.id,
876
+ date: BigInt(data.date),
877
+ totalVolume: BigInt(data.totalVolume),
878
+ totalPremium: BigInt(data.totalPremium),
879
+ totalPayout: BigInt(data.totalPayout)
880
+ }));
881
+ },
882
+ enabled: !!marketAddr && !!timelockGraphqlClient
883
+ });
884
+ };
885
+
840
886
  //#endregion
841
887
  //#region src/hooks/options/useMaxPositionSize.ts
842
888
  const useMaxPositionSize = (marketAddr, strikeTick, maxSteps = 100) => {
@@ -1488,7 +1534,6 @@ const useOptionTimeline = (marketAddr, optionId) => {
1488
1534
  const exerciseEvents = result.ExerciseOptionEvent.map((event) => ({
1489
1535
  id: event.id,
1490
1536
  payout: BigInt(event.payout),
1491
- price: BigInt(event.price),
1492
1537
  liquidities: event.liquidities.map((l) => BigInt(l)),
1493
1538
  timestamp: /* @__PURE__ */ new Date(Number(event.timestamp) * 1e3),
1494
1539
  blockNumber: BigInt(event.blockNumber),
@@ -2592,6 +2637,7 @@ exports.useFeeRates = useFeeRates;
2592
2637
  exports.useGlobalGuardianState = useGlobalGuardianState;
2593
2638
  exports.useLens = useLens;
2594
2639
  exports.useLiquidityBlocks = useLiquidityBlocks;
2640
+ exports.useMarketDailyVolume = useMarketDailyVolume;
2595
2641
  exports.useMarketData = useMarketData;
2596
2642
  exports.useMarketGuardianState = useMarketGuardianState;
2597
2643
  exports.useMarketPriceHistory = useMarketPriceHistory;