@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.d.mts CHANGED
@@ -223,7 +223,7 @@ interface MarketTradeStreamOptions {
223
223
  level?: number;
224
224
  }
225
225
  declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStreamOptions) => {
226
- trades: API.Trade[];
226
+ data: API.Trade[] | undefined;
227
227
  isLoading: boolean;
228
228
  };
229
229
 
package/dist/index.d.ts CHANGED
@@ -223,7 +223,7 @@ interface MarketTradeStreamOptions {
223
223
  level?: number;
224
224
  }
225
225
  declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStreamOptions) => {
226
- trades: API.Trade[];
226
+ data: API.Trade[] | undefined;
227
227
  isLoading: boolean;
228
228
  };
229
229
 
package/dist/index.js CHANGED
@@ -1741,32 +1741,32 @@ var useMarketTradeStream = (symbol, options = {}) => {
1741
1741
  if (!symbol) {
1742
1742
  throw new Error("useTradeStream: symbol is required");
1743
1743
  }
1744
- const [trades, setTrades] = React2.useState([]);
1744
+ React2.useState([]);
1745
1745
  const { level = 20 } = options;
1746
- const { isLoading } = useQuery(
1747
- `/v1/public/market_trades?symbol=${symbol}&limit=${level}`,
1748
- {
1749
- onSuccess: (data) => {
1750
- console.log("trades ^^^^^^", data);
1751
- if (Array.isArray(data)) {
1752
- setTrades(data);
1753
- }
1754
- return data;
1755
- }
1756
- }
1746
+ const { data, isLoading } = useQuery(
1747
+ `/v1/public/market_trades?symbol=${symbol}&limit=${level}`
1748
+ // {
1749
+ // onSuccess: (data) => {
1750
+ // // console.log("trades ^^^^^^", data);
1751
+ // if (Array.isArray(data)) {
1752
+ // setTrades(data);
1753
+ // }
1754
+ // return data;
1755
+ // },
1756
+ // }
1757
1757
  );
1758
1758
  const ws = useWS();
1759
1759
  React2.useEffect(() => {
1760
1760
  const unsubscript = ws.subscribe(`@${symbol}/@trade`, {
1761
- onMessage: (data) => {
1762
- console.log("trade", data);
1761
+ onMessage: (data2) => {
1762
+ console.log("trade", data2);
1763
1763
  }
1764
1764
  });
1765
1765
  return () => {
1766
1766
  unsubscript == null ? void 0 : unsubscript();
1767
1767
  };
1768
1768
  }, []);
1769
- return { trades, isLoading };
1769
+ return { data, isLoading };
1770
1770
  };
1771
1771
 
1772
1772
  // src/orderly/useTrades.tsx