@orderly.network/hooks 2.3.1-alpha.0 → 2.3.2-alpha.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
@@ -31,7 +31,7 @@ declare global {
31
31
  };
32
32
  }
33
33
  }
34
- declare const _default: "2.3.1-alpha.0";
34
+ declare const _default: "2.3.2-alpha.0";
35
35
 
36
36
  declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
37
37
  type useQueryOptions<T> = SWRConfiguration & {
@@ -896,6 +896,7 @@ type Receiver = {
896
896
  amount: number;
897
897
  };
898
898
  type TransferOptions = {
899
+ /** if not provided, use current account id */
899
900
  fromAccountId?: string;
900
901
  };
901
902
  declare const useTransfer: (options?: TransferOptions) => {
@@ -1143,6 +1144,13 @@ interface TransferHistorySearchParams {
1143
1144
  fromId?: string;
1144
1145
  toId?: string;
1145
1146
  side: "IN" | "OUT";
1147
+ /**
1148
+ * If True, return only internal transfers between main account and sub-accounts.
1149
+ * If False, return only internal transfers between main account and other main accounts.
1150
+ * If empty, return all transfer history.
1151
+ * @default true
1152
+ */
1153
+ main_sub_only?: boolean;
1146
1154
  }
1147
1155
  declare const useTransferHistory: (parmas: TransferHistorySearchParams) => readonly [API.TransferHistoryRow[], {
1148
1156
  readonly meta: API.RecordsMeta | undefined;
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ declare global {
31
31
  };
32
32
  }
33
33
  }
34
- declare const _default: "2.3.1-alpha.0";
34
+ declare const _default: "2.3.2-alpha.0";
35
35
 
36
36
  declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
37
37
  type useQueryOptions<T> = SWRConfiguration & {
@@ -896,6 +896,7 @@ type Receiver = {
896
896
  amount: number;
897
897
  };
898
898
  type TransferOptions = {
899
+ /** if not provided, use current account id */
899
900
  fromAccountId?: string;
900
901
  };
901
902
  declare const useTransfer: (options?: TransferOptions) => {
@@ -1143,6 +1144,13 @@ interface TransferHistorySearchParams {
1143
1144
  fromId?: string;
1144
1145
  toId?: string;
1145
1146
  side: "IN" | "OUT";
1147
+ /**
1148
+ * If True, return only internal transfers between main account and sub-accounts.
1149
+ * If False, return only internal transfers between main account and other main accounts.
1150
+ * If empty, return all transfer history.
1151
+ * @default true
1152
+ */
1153
+ main_sub_only?: boolean;
1146
1154
  }
1147
1155
  declare const useTransferHistory: (parmas: TransferHistorySearchParams) => readonly [API.TransferHistoryRow[], {
1148
1156
  readonly meta: API.RecordsMeta | undefined;
package/dist/index.js CHANGED
@@ -61,9 +61,9 @@ var __export = (target, all) => {
61
61
  // src/version.ts
62
62
  if (typeof window !== "undefined") {
63
63
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
64
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.3.1-alpha.0";
64
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.3.2-alpha.0";
65
65
  }
66
- var version_default = "2.3.1-alpha.0";
66
+ var version_default = "2.3.2-alpha.0";
67
67
  var fetcher = (url, init2 = {}, queryOptions) => net.get(url, init2, queryOptions?.formatter);
68
68
  var OrderlyContext = React.createContext({
69
69
  // configStore: new MemoryConfigStore(),
@@ -2299,6 +2299,10 @@ var useTickerStream = (symbol) => {
2299
2299
  };
2300
2300
 
2301
2301
  // src/orderly/useOrderbookStream.ts
2302
+ var DEFAULT_DEPTH = {
2303
+ PERP_BTC_USDC: "1",
2304
+ PERP_ETH_USDC: "0.1"
2305
+ };
2302
2306
  var paddingFn = (len) => Array(len).fill([
2303
2307
  Number.NaN,
2304
2308
  Number.NaN,
@@ -2430,8 +2434,12 @@ var useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
2430
2434
  return [tick];
2431
2435
  }, [config("quote_tick")]);
2432
2436
  React.useEffect(() => {
2433
- setDepth(config("quote_tick"));
2434
- }, [config("quote_tick")]);
2437
+ if (DEFAULT_DEPTH[symbol]) {
2438
+ setDepth(Number(DEFAULT_DEPTH[symbol]));
2439
+ } else {
2440
+ setDepth(config("quote_tick"));
2441
+ }
2442
+ }, [config("quote_tick"), symbol]);
2435
2443
  const ws = useWS();
2436
2444
  const ticker = useTickerStream(symbol);
2437
2445
  const eventEmitter = useEventEmitter();
@@ -6979,20 +6987,22 @@ var useDistributionHistory = (parmas) => {
6979
6987
  return [parsedData, { meta: data?.meta, isLoading, isValidating }];
6980
6988
  };
6981
6989
  var useTransferHistory = (parmas) => {
6982
- const { dataRange, page, size, side, fromId, toId } = parmas;
6990
+ const { dataRange, page, size, side, fromId, toId, main_sub_only } = parmas;
6983
6991
  const infos = useSymbolsInfo();
6984
6992
  const memoizedQueryKey = React__default.default.useMemo(() => {
6985
6993
  const search = new URLSearchParams();
6986
6994
  search.set("page", page.toString());
6987
6995
  search.set("size", size.toString());
6988
6996
  search.set("side", side);
6989
- search.set("main_sub_only", `${true}`);
6997
+ if (main_sub_only === true || main_sub_only === false) {
6998
+ search.set("main_sub_only", main_sub_only.toString());
6999
+ }
6990
7000
  if (dataRange) {
6991
7001
  search.set("start_t", dataRange[0].toString());
6992
7002
  search.set("end_t", dataRange[1].toString());
6993
7003
  }
6994
7004
  return `/v1/internal_transfer_history?${search.toString()}`;
6995
- }, [page, size, fromId, toId, dataRange]);
7005
+ }, [page, size, fromId, toId, dataRange, main_sub_only]);
6996
7006
  const { data, isLoading } = usePrivateQuery(
6997
7007
  memoizedQueryKey,
6998
7008
  {