@orderly.network/hooks 2.0.1-alpha.7 → 2.0.1-preview.0

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/index.d.mts CHANGED
@@ -27,7 +27,7 @@ declare global {
27
27
  };
28
28
  }
29
29
  }
30
- declare const _default: "2.0.1-alpha.7";
30
+ declare const _default: "2.0.1-preview.0";
31
31
 
32
32
  type useQueryOptions<T> = SWRConfiguration & {
33
33
  formatter?: (data: any) => T;
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare global {
27
27
  };
28
28
  }
29
29
  }
30
- declare const _default: "2.0.1-alpha.7";
30
+ declare const _default: "2.0.1-preview.0";
31
31
 
32
32
  type useQueryOptions<T> = SWRConfiguration & {
33
33
  formatter?: (data: any) => T;
package/dist/index.js CHANGED
@@ -40,9 +40,9 @@ var __export = (target, all) => {
40
40
  // src/version.ts
41
41
  if (typeof window !== "undefined") {
42
42
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
43
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-alpha.7";
43
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-preview.0";
44
44
  }
45
- var version_default = "2.0.1-alpha.7";
45
+ var version_default = "2.0.1-preview.0";
46
46
  var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
47
47
  var OrderlyContext = React.createContext({
48
48
  // configStore: new MemoryConfigStore(),
@@ -2744,9 +2744,12 @@ var filterMarkets = (params) => {
2744
2744
  isFavorite: type == 0 /* FAVORITES */ ? true : favoriteKeys.includes(item.symbol)
2745
2745
  }));
2746
2746
  };
2747
+ function isEmpty(value) {
2748
+ return value === void 0 || value === null;
2749
+ }
2747
2750
  function get8hFunding2(est_funding_rate, funding_period) {
2748
2751
  let funding8h = 0;
2749
- if (est_funding_rate === void 0 || est_funding_rate === null) {
2752
+ if (isEmpty(est_funding_rate)) {
2750
2753
  return null;
2751
2754
  }
2752
2755
  if (funding_period) {
@@ -2759,7 +2762,7 @@ function get24hChange2(params) {
2759
2762
  if (change !== void 0) {
2760
2763
  return change;
2761
2764
  }
2762
- if (close !== void 0 && open !== void 0) {
2765
+ if (!isEmpty(close) && !isEmpty(open)) {
2763
2766
  if (open === 0) {
2764
2767
  return 0;
2765
2768
  }
@@ -3487,7 +3490,7 @@ var useMaxQty = (symbol, side, reduceOnly = false) => {
3487
3490
  return 0;
3488
3491
  const getSymbolInfo = symbolInfo[symbol];
3489
3492
  const filterAlgoOrders = orders.filter(
3490
- (item) => item.algo_order_id === void 0
3493
+ (item) => item.algo_order_id === void 0 || item.algo_type === "BRACKET"
3491
3494
  );
3492
3495
  const buyOrdersQty = perp.account.getQtyFromOrdersBySide(
3493
3496
  filterAlgoOrders,
@@ -5880,7 +5883,7 @@ function useMaintenanceStatus() {
5880
5883
  const [startTime, setStartTime] = React.useState();
5881
5884
  const [endTime, setEndTime] = React.useState();
5882
5885
  const [brokerName, setBrokerName] = React.useState("Orderly network");
5883
- const { data: systemInfo, mutate: mutate3 } = useQuery(`/v1/public/system_info`, {
5886
+ const { data: systemInfo, mutate: mutate3 } = useQuery(`/v1/public/system_info?source=maintenance`, {
5884
5887
  revalidateOnFocus: false,
5885
5888
  errorRetryCount: 2,
5886
5889
  errorRetryInterval: 200
@@ -5888,18 +5891,18 @@ function useMaintenanceStatus() {
5888
5891
  const ws = useWS();
5889
5892
  const config = useConfig();
5890
5893
  React.useEffect(() => {
5891
- if (!systemInfo || !systemInfo.data) {
5894
+ if (!systemInfo) {
5892
5895
  return;
5893
5896
  }
5894
5897
  const brokerName2 = config.get("brokerName");
5895
5898
  if (brokerName2) {
5896
5899
  setBrokerName(brokerName2);
5897
5900
  }
5898
- if (systemInfo.data.scheduled_maintenance) {
5899
- setStartTime(systemInfo.data.scheduled_maintenance.start_time);
5900
- setEndTime(systemInfo.data.scheduled_maintenance.end_time);
5901
+ if (systemInfo.scheduled_maintenance) {
5902
+ setStartTime(systemInfo.scheduled_maintenance.start_time);
5903
+ setEndTime(systemInfo.scheduled_maintenance.end_time);
5901
5904
  }
5902
- if (systemInfo.data.status === 2) {
5905
+ if (systemInfo.status === 2) {
5903
5906
  setStatus(2);
5904
5907
  }
5905
5908
  }, [systemInfo, config]);