@orderly.network/hooks 0.0.20 → 0.0.21

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
@@ -1732,32 +1732,32 @@ var useMarketTradeStream = (symbol, options = {}) => {
1732
1732
  if (!symbol) {
1733
1733
  throw new Error("useTradeStream: symbol is required");
1734
1734
  }
1735
- const [trades, setTrades] = useState([]);
1735
+ useState([]);
1736
1736
  const { level = 20 } = options;
1737
- const { isLoading } = useQuery(
1738
- `/v1/public/market_trades?symbol=${symbol}&limit=${level}`,
1739
- {
1740
- onSuccess: (data) => {
1741
- console.log("trades ^^^^^^", data);
1742
- if (Array.isArray(data)) {
1743
- setTrades(data);
1744
- }
1745
- return data;
1746
- }
1747
- }
1737
+ const { data, isLoading } = useQuery(
1738
+ `/v1/public/market_trades?symbol=${symbol}&limit=${level}`
1739
+ // {
1740
+ // onSuccess: (data) => {
1741
+ // // console.log("trades ^^^^^^", data);
1742
+ // if (Array.isArray(data)) {
1743
+ // setTrades(data);
1744
+ // }
1745
+ // return data;
1746
+ // },
1747
+ // }
1748
1748
  );
1749
1749
  const ws = useWS();
1750
1750
  useEffect(() => {
1751
1751
  const unsubscript = ws.subscribe(`@${symbol}/@trade`, {
1752
- onMessage: (data) => {
1753
- console.log("trade", data);
1752
+ onMessage: (data2) => {
1753
+ console.log("trade", data2);
1754
1754
  }
1755
1755
  });
1756
1756
  return () => {
1757
1757
  unsubscript == null ? void 0 : unsubscript();
1758
1758
  };
1759
1759
  }, []);
1760
- return { trades, isLoading };
1760
+ return { data, isLoading };
1761
1761
  };
1762
1762
 
1763
1763
  // src/orderly/useTrades.tsx