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

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.mjs CHANGED
@@ -32,9 +32,9 @@ var __export = (target, all) => {
32
32
  // src/version.ts
33
33
  if (typeof window !== "undefined") {
34
34
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
35
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-alpha.7";
35
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-preview.1";
36
36
  }
37
- var version_default = "2.0.1-alpha.7";
37
+ var version_default = "2.0.1-preview.1";
38
38
  var fetcher = (url, init = {}, queryOptions) => get(url, init, queryOptions?.formatter);
39
39
  var OrderlyContext = createContext({
40
40
  // configStore: new MemoryConfigStore(),
@@ -2736,9 +2736,12 @@ var filterMarkets = (params) => {
2736
2736
  isFavorite: type == 0 /* FAVORITES */ ? true : favoriteKeys.includes(item.symbol)
2737
2737
  }));
2738
2738
  };
2739
+ function isEmpty(value) {
2740
+ return value === void 0 || value === null;
2741
+ }
2739
2742
  function get8hFunding2(est_funding_rate, funding_period) {
2740
2743
  let funding8h = 0;
2741
- if (est_funding_rate === void 0 || est_funding_rate === null) {
2744
+ if (isEmpty(est_funding_rate)) {
2742
2745
  return null;
2743
2746
  }
2744
2747
  if (funding_period) {
@@ -2751,7 +2754,7 @@ function get24hChange2(params) {
2751
2754
  if (change !== void 0) {
2752
2755
  return change;
2753
2756
  }
2754
- if (close !== void 0 && open !== void 0) {
2757
+ if (!isEmpty(close) && !isEmpty(open)) {
2755
2758
  if (open === 0) {
2756
2759
  return 0;
2757
2760
  }
@@ -3479,7 +3482,7 @@ var useMaxQty = (symbol, side, reduceOnly = false) => {
3479
3482
  return 0;
3480
3483
  const getSymbolInfo = symbolInfo[symbol];
3481
3484
  const filterAlgoOrders = orders.filter(
3482
- (item) => item.algo_order_id === void 0
3485
+ (item) => item.algo_order_id === void 0 || item.algo_type === "BRACKET"
3483
3486
  );
3484
3487
  const buyOrdersQty = account.getQtyFromOrdersBySide(
3485
3488
  filterAlgoOrders,
@@ -5872,7 +5875,7 @@ function useMaintenanceStatus() {
5872
5875
  const [startTime, setStartTime] = useState();
5873
5876
  const [endTime, setEndTime] = useState();
5874
5877
  const [brokerName, setBrokerName] = useState("Orderly network");
5875
- const { data: systemInfo, mutate: mutate3 } = useQuery(`/v1/public/system_info`, {
5878
+ const { data: systemInfo, mutate: mutate3 } = useQuery(`/v1/public/system_info?source=maintenance`, {
5876
5879
  revalidateOnFocus: false,
5877
5880
  errorRetryCount: 2,
5878
5881
  errorRetryInterval: 200
@@ -5880,18 +5883,18 @@ function useMaintenanceStatus() {
5880
5883
  const ws = useWS();
5881
5884
  const config = useConfig();
5882
5885
  useEffect(() => {
5883
- if (!systemInfo || !systemInfo.data) {
5886
+ if (!systemInfo) {
5884
5887
  return;
5885
5888
  }
5886
5889
  const brokerName2 = config.get("brokerName");
5887
5890
  if (brokerName2) {
5888
5891
  setBrokerName(brokerName2);
5889
5892
  }
5890
- if (systemInfo.data.scheduled_maintenance) {
5891
- setStartTime(systemInfo.data.scheduled_maintenance.start_time);
5892
- setEndTime(systemInfo.data.scheduled_maintenance.end_time);
5893
+ if (systemInfo.scheduled_maintenance) {
5894
+ setStartTime(systemInfo.scheduled_maintenance.start_time);
5895
+ setEndTime(systemInfo.scheduled_maintenance.end_time);
5893
5896
  }
5894
- if (systemInfo.data.status === 2) {
5897
+ if (systemInfo.status === 2) {
5895
5898
  setStatus(2);
5896
5899
  }
5897
5900
  }, [systemInfo, config]);