@orderly.network/hooks 0.0.87 → 0.0.89

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
@@ -6,7 +6,7 @@ import useSWRMutation from 'swr/mutation';
6
6
  import useConstant from 'use-constant';
7
7
  export { default as useConstant } from 'use-constant';
8
8
  import { SimpleDI, Account, EventEmitter, utils } from '@orderly.network/core';
9
- import { AccountStatusEnum, OrderSide, chainsInfoMap, ARBITRUM_TESTNET_CHAINID, ARBITRUM_MAINNET_CHAINID, OrderStatus as OrderStatus$1, WS_WalletStatusEnum, OrderType } from '@orderly.network/types';
9
+ import { AccountStatusEnum, OrderSide, chainsInfoMap, ARBITRUM_TESTNET_CHAINID, ARBITRUM_MAINNET_CHAINID, WS_WalletStatusEnum, OrderType } from '@orderly.network/types';
10
10
  import { Decimal, zero, getPrecisionByNumber, timeConvertString } from '@orderly.network/utils';
11
11
  import useSWRSubscription from 'swr/subscription';
12
12
  import { pathOr, propOr, compose, head, prop, mergeDeepRight, pick } from 'ramda';
@@ -1815,13 +1815,14 @@ var usePrivateInfiniteQuery = (getKey, options) => {
1815
1815
  );
1816
1816
  return result;
1817
1817
  };
1818
- var OrderStatus = /* @__PURE__ */ ((OrderStatus3) => {
1819
- OrderStatus3["FILLED"] = "FILLED";
1820
- OrderStatus3["PARTIAL_FILLED"] = "PARTIAL_FILLED";
1821
- OrderStatus3["CANCELED"] = "CANCELED";
1822
- OrderStatus3["NEW"] = "NEW";
1823
- OrderStatus3["COMPLETED"] = "COMPLETED";
1824
- return OrderStatus3;
1818
+ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
1819
+ OrderStatus2["FILLED"] = "FILLED";
1820
+ OrderStatus2["PARTIAL_FILLED"] = "PARTIAL_FILLED";
1821
+ OrderStatus2["CANCELED"] = "CANCELED";
1822
+ OrderStatus2["NEW"] = "NEW";
1823
+ OrderStatus2["COMPLETED"] = "COMPLETED";
1824
+ OrderStatus2["INCOMPLETE"] = "INCOMPLETE";
1825
+ return OrderStatus2;
1825
1826
  })(OrderStatus || {});
1826
1827
  var useOrderStream = ({
1827
1828
  status,
@@ -1872,7 +1873,9 @@ var useOrderStream = ({
1872
1873
  });
1873
1874
  }, [ordersResponse.data, markPrices]);
1874
1875
  useEffect(() => {
1875
- const handler = () => ordersResponse.mutate();
1876
+ const handler = () => {
1877
+ ordersResponse.mutate();
1878
+ };
1876
1879
  ee.on("orders:changed", handler);
1877
1880
  return () => {
1878
1881
  ee.off("orders:changed", handler);
@@ -3461,33 +3464,6 @@ var usePrivateDataObserver = () => {
3461
3464
  useEffect(() => {
3462
3465
  const unsubscribe = ws.privateSubscribe("executionreport", {
3463
3466
  onMessage: (data) => {
3464
- const key = ["/v1/orders?status=NEW", state.accountId];
3465
- mutate2(key, (orders) => {
3466
- return Promise.resolve().then(() => {
3467
- if (!orders) {
3468
- return orders;
3469
- }
3470
- if (data.status === OrderStatus$1.NEW) {
3471
- return [
3472
- {
3473
- ...data,
3474
- // average_executed_price:data.ava
3475
- created_time: data.timestamp,
3476
- order_id: data.orderId
3477
- // reduce_only
3478
- },
3479
- ...orders
3480
- ];
3481
- }
3482
- if (data.status === OrderStatus$1.CANCELLED) {
3483
- return orders.filter(
3484
- (order2) => order2.order_id !== data.orderId
3485
- );
3486
- }
3487
- return orders;
3488
- }).catch((error) => {
3489
- });
3490
- });
3491
3467
  ee.emit("orders:changed");
3492
3468
  }
3493
3469
  });