@orderly.network/hooks 2.8.9-alpha.0 → 2.8.10-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
@@ -37,7 +37,7 @@ declare global {
37
37
  };
38
38
  }
39
39
  }
40
- declare const _default: "2.8.9-alpha.0";
40
+ declare const _default: "2.8.10-alpha.0";
41
41
 
42
42
  declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
43
43
  type useQueryOptions<T> = SWRConfiguration & {
@@ -598,6 +598,9 @@ declare class ExtendedConfigStore extends DefaultConfigStore {
598
598
  set<T>(key: ConfigKey, value: T): void;
599
599
  }
600
600
 
601
+ type WalletProvider = (EIP1193Provider | SolanaWalletProvider) & {
602
+ publicKey?: SolanaWalletProvider["publicKey"];
603
+ };
601
604
  type ConnectedChain = {
602
605
  id: number | string;
603
606
  namespace: ChainNamespace;
@@ -608,7 +611,7 @@ type WalletAccount = {
608
611
  interface WalletState {
609
612
  label: string;
610
613
  icon: string;
611
- provider: EIP1193Provider | SolanaWalletProvider;
614
+ provider: WalletProvider;
612
615
  accounts: WalletAccount[];
613
616
  chains: ConnectedChain[];
614
617
  instance?: unknown;
@@ -1094,7 +1097,7 @@ params: {
1094
1097
  readonly refresh: () => void;
1095
1098
  readonly loadMore: () => void;
1096
1099
  readonly cancelAllOrders: () => Promise<[any, any, any]>;
1097
- readonly cancelAllPendingOrders: (symbol?: string) => void;
1100
+ readonly cancelAllPendingOrders: (symbol?: string) => Promise<[any, any, any]>;
1098
1101
  readonly cancelAllTPSLOrders: (symbol?: string) => Promise<any[]>;
1099
1102
  readonly cancelAlgoOrdersByTypes: (types: AlgoOrderRootType[], symbol?: string) => Promise<any[]>;
1100
1103
  readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ declare global {
37
37
  };
38
38
  }
39
39
  }
40
- declare const _default: "2.8.9-alpha.0";
40
+ declare const _default: "2.8.10-alpha.0";
41
41
 
42
42
  declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
43
43
  type useQueryOptions<T> = SWRConfiguration & {
@@ -598,6 +598,9 @@ declare class ExtendedConfigStore extends DefaultConfigStore {
598
598
  set<T>(key: ConfigKey, value: T): void;
599
599
  }
600
600
 
601
+ type WalletProvider = (EIP1193Provider | SolanaWalletProvider) & {
602
+ publicKey?: SolanaWalletProvider["publicKey"];
603
+ };
601
604
  type ConnectedChain = {
602
605
  id: number | string;
603
606
  namespace: ChainNamespace;
@@ -608,7 +611,7 @@ type WalletAccount = {
608
611
  interface WalletState {
609
612
  label: string;
610
613
  icon: string;
611
- provider: EIP1193Provider | SolanaWalletProvider;
614
+ provider: WalletProvider;
612
615
  accounts: WalletAccount[];
613
616
  chains: ConnectedChain[];
614
617
  instance?: unknown;
@@ -1094,7 +1097,7 @@ params: {
1094
1097
  readonly refresh: () => void;
1095
1098
  readonly loadMore: () => void;
1096
1099
  readonly cancelAllOrders: () => Promise<[any, any, any]>;
1097
- readonly cancelAllPendingOrders: (symbol?: string) => void;
1100
+ readonly cancelAllPendingOrders: (symbol?: string) => Promise<[any, any, any]>;
1098
1101
  readonly cancelAllTPSLOrders: (symbol?: string) => Promise<any[]>;
1099
1102
  readonly cancelAlgoOrdersByTypes: (types: AlgoOrderRootType[], symbol?: string) => Promise<any[]>;
1100
1103
  readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
package/dist/index.js CHANGED
@@ -64,9 +64,9 @@ var __export = (target, all) => {
64
64
  // src/version.ts
65
65
  if (typeof window !== "undefined") {
66
66
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
67
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.8.9-alpha.0";
67
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.8.10-alpha.0";
68
68
  }
69
- var version_default = "2.8.9-alpha.0";
69
+ var version_default = "2.8.10-alpha.0";
70
70
  var fetcher = (url, init2 = {}, queryOptions) => net.get(url, init2, queryOptions?.formatter);
71
71
  var noCacheConfig = {
72
72
  dedupingInterval: 0,
@@ -5469,12 +5469,18 @@ var PositionCalculator = class extends BaseCalculator {
5469
5469
  if (portfolio) {
5470
5470
  const { totalValue, totalCollateral } = portfolio;
5471
5471
  rows = rows.map((item) => {
5472
+ const info = symbolsInfo[item.symbol];
5472
5473
  const est_liq_price = perp.positions.liqPrice({
5474
+ symbol: item.symbol,
5473
5475
  markPrice: item.mark_price,
5474
5476
  totalCollateral: totalCollateral.toNumber(),
5475
5477
  positionQty: item.position_qty,
5476
5478
  positions: rows,
5477
- MMR: item.mmr
5479
+ MMR: item.mmr,
5480
+ baseMMR: info?.["base_mmr"],
5481
+ baseIMR: info?.["base_imr"],
5482
+ IMRFactor: accountInfo.imr_factor[item.symbol],
5483
+ costPosition: item.cost_position
5478
5484
  });
5479
5485
  return {
5480
5486
  ...item,
@@ -6063,9 +6069,22 @@ var useOrderStream = (params, options) => {
6063
6069
  })
6064
6070
  ]);
6065
6071
  }, [normalOrdersResponse.data, algoOrdersResponse.data]);
6066
- const cancelAllPendingOrders = React2.useCallback((symbol2) => {
6067
- doCancelAllOrders(null, { ...symbol2 && { symbol: symbol2 } });
6068
- }, []);
6072
+ const cancelAllPendingOrders = React2.useCallback(
6073
+ (symbol2) => {
6074
+ return Promise.all([
6075
+ doCancelAllOrders(null, { ...symbol2 && { symbol: symbol2 } }),
6076
+ doCancelAllAlgoOrders(null, {
6077
+ algo_type: types.AlgoOrderRootType.STOP,
6078
+ ...symbol2 && { symbol: symbol2 }
6079
+ }),
6080
+ doCancelAllAlgoOrders(null, {
6081
+ algo_type: types.AlgoOrderRootType.TRAILING_STOP,
6082
+ ...symbol2 && { symbol: symbol2 }
6083
+ })
6084
+ ]);
6085
+ },
6086
+ [symbol]
6087
+ );
6069
6088
  const cancelPostionOrdersByTypes = React2.useCallback(
6070
6089
  (symbol2, types) => {
6071
6090
  return doCancelAllAlgoOrders(null, {