@orderly.network/hooks 2.0.1-preview.2 → 2.0.1-preview.4

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
@@ -27,7 +27,7 @@ declare global {
27
27
  };
28
28
  }
29
29
  }
30
- declare const _default: "2.0.1-preview.2";
30
+ declare const _default: "2.0.1-preview.4";
31
31
 
32
32
  type useQueryOptions<T> = SWRConfiguration & {
33
33
  formatter?: (data: any) => T;
@@ -1417,7 +1417,7 @@ declare const useApiKeyManager: (queryParams?: {
1417
1417
  keyInfo?: {
1418
1418
  page?: number;
1419
1419
  size?: number;
1420
- keyStatus?: string;
1420
+ key_status?: string;
1421
1421
  };
1422
1422
  }) => readonly [APIKeyItem[] | undefined, {
1423
1423
  readonly refresh: swr__internal.KeyedMutator<APIKeyItem[]>;
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare global {
27
27
  };
28
28
  }
29
29
  }
30
- declare const _default: "2.0.1-preview.2";
30
+ declare const _default: "2.0.1-preview.4";
31
31
 
32
32
  type useQueryOptions<T> = SWRConfiguration & {
33
33
  formatter?: (data: any) => T;
@@ -1417,7 +1417,7 @@ declare const useApiKeyManager: (queryParams?: {
1417
1417
  keyInfo?: {
1418
1418
  page?: number;
1419
1419
  size?: number;
1420
- keyStatus?: string;
1420
+ key_status?: string;
1421
1421
  };
1422
1422
  }) => readonly [APIKeyItem[] | undefined, {
1423
1423
  readonly refresh: swr__internal.KeyedMutator<APIKeyItem[]>;
package/dist/index.js CHANGED
@@ -40,9 +40,9 @@ var __export = (target, all) => {
40
40
  // src/version.ts
41
41
  if (typeof window !== "undefined") {
42
42
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
43
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-preview.2";
43
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-preview.4";
44
44
  }
45
- var version_default = "2.0.1-preview.2";
45
+ var version_default = "2.0.1-preview.4";
46
46
  var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
47
47
  var OrderlyContext = React.createContext({
48
48
  // configStore: new MemoryConfigStore(),
@@ -1601,6 +1601,18 @@ var PortfolioCalculator = class extends BaseCalculator {
1601
1601
  (output) => output.positionCalculator_all
1602
1602
  );
1603
1603
  let holding = portfolio.holding;
1604
+ if (scope === "portfolio" /* PORTFOLIO */ && data.holding && Array.isArray(holding)) {
1605
+ holding = holding.map((item) => {
1606
+ if (data.holding[item.token]) {
1607
+ return {
1608
+ ...item,
1609
+ holding: data.holding[item.token].holding,
1610
+ frozen: data.holding[item.token].frozen
1611
+ };
1612
+ }
1613
+ return item;
1614
+ });
1615
+ }
1604
1616
  const accountInfo = ctx.accountInfo;
1605
1617
  const symbolsInfo = ctx.symbolsInfo;
1606
1618
  return this.format({
@@ -5931,7 +5943,9 @@ var usePrivateDataObserver = (options) => {
5931
5943
  const ws = useWS();
5932
5944
  const ee = useEventEmitter();
5933
5945
  const { state, account: account5 } = useAccount();
5934
- const { setAccountInfo, restoreHolding, updateHolding, cleanAll } = useAppStore((state2) => state2.actions);
5946
+ const { setAccountInfo, restoreHolding, cleanAll } = useAppStore(
5947
+ (state2) => state2.actions
5948
+ );
5935
5949
  const statusActions = useApiStatusActions();
5936
5950
  const calculatorService = useCalculatorService();
5937
5951
  const positionsActions = usePositionActions();
@@ -5990,7 +6004,7 @@ var usePrivateDataObserver = (options) => {
5990
6004
  onMessage: (data) => {
5991
6005
  const holding2 = data?.balances ?? {};
5992
6006
  if (holding2) {
5993
- updateHolding(holding2);
6007
+ calculatorService.calc("portfolio" /* PORTFOLIO */, { holding: holding2 });
5994
6008
  }
5995
6009
  }
5996
6010
  }