@kodiak-finance/orderly-ui-orders 2.8.33 → 2.9.0-rc.2

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.js CHANGED
@@ -285,7 +285,7 @@ var init_shareButton_script = __esm({
285
285
  const refCode = React2.useMemo(() => {
286
286
  return getFirstRefCode()?.code;
287
287
  }, [getFirstRefCode]);
288
- const leverage = orderlyHooks.useLeverageBySymbol(order.symbol);
288
+ const leverage = orderlyHooks.useLeverageBySymbol(order.symbol, order.margin_mode);
289
289
  const showModal = () => {
290
290
  orderlyUi.modal.show(props.modalId, {
291
291
  pnl: {
@@ -824,6 +824,9 @@ var init_activedPriceCell = __esm({
824
824
  algo_order_id: order.algo_order_id,
825
825
  activated_price: value
826
826
  };
827
+ if (order.margin_mode !== void 0) {
828
+ data.margin_mode = order.margin_mode;
829
+ }
827
830
  editAlgoOrder(order.algo_order_id.toString(), data).then((result) => {
828
831
  closePopover();
829
832
  setValue(value);
@@ -953,7 +956,7 @@ var init_priceCell = __esm({
953
956
  order_quantity: order.quantity,
954
957
  order_price: value
955
958
  };
956
- if (order.reduce_only) {
959
+ if (order.reduce_only !== void 0) {
957
960
  data.reduce_only = order.reduce_only;
958
961
  }
959
962
  if (order.order_tag) {
@@ -962,6 +965,9 @@ var init_priceCell = __esm({
962
965
  if (order.client_order_id) {
963
966
  data.client_order_id = order.client_order_id;
964
967
  }
968
+ if (order.margin_mode !== void 0) {
969
+ data.margin_mode = order.margin_mode;
970
+ }
965
971
  if (isAlgoOrder) {
966
972
  order_id = order.algo_order_id;
967
973
  data = {
@@ -1390,6 +1396,9 @@ var init_quantityCell = __esm({
1390
1396
  if (order?.tag !== void 0) {
1391
1397
  params["order_tag"] = order.tag;
1392
1398
  }
1399
+ if (order.margin_mode !== void 0) {
1400
+ params.margin_mode = order.margin_mode;
1401
+ }
1393
1402
  let future;
1394
1403
  if ("algo_type" in order && order.algo_type === orderlyTypes.AlgoOrderRootType.TP_SL) {
1395
1404
  future = onUpdateTPSLOrder(order, params);
@@ -1555,7 +1564,10 @@ var init_quantityCell = __esm({
1555
1564
  confirmOpen,
1556
1565
  order
1557
1566
  } = props;
1558
- const maxBuyQty = orderlyHooks.useMaxQty(symbol, order.side, order.reduce_only);
1567
+ const maxBuyQty = orderlyHooks.useMaxQty(symbol, order.side, {
1568
+ reduceOnly: order.reduce_only,
1569
+ marginMode: order.margin_mode ?? orderlyTypes.MarginMode.CROSS
1570
+ });
1559
1571
  const maxQty = React2.useMemo(() => {
1560
1572
  if (reduce_only) {
1561
1573
  return Math.abs(positionQty ?? 0);
@@ -1790,6 +1802,9 @@ var init_trailingCallbackCell = __esm({
1790
1802
  callback_value: isCallbackValue ? value : void 0,
1791
1803
  callback_rate: isCallbackRate ? `${Number(value) / 100}` : void 0
1792
1804
  };
1805
+ if (order.margin_mode !== void 0) {
1806
+ data.margin_mode = order.margin_mode;
1807
+ }
1793
1808
  editAlgoOrder(order.algo_order_id.toString(), data).then((result) => {
1794
1809
  closePopover();
1795
1810
  setValue(value);
@@ -1906,6 +1921,9 @@ var init_triggerPriceCell = __esm({
1906
1921
  trigger_price: value,
1907
1922
  algo_order_id: order.algo_order_id
1908
1923
  };
1924
+ if (order.margin_mode !== void 0) {
1925
+ data.margin_mode = order.margin_mode;
1926
+ }
1909
1927
  editAlgoOrder(`${order.algo_order_id}`, data).then((result) => {
1910
1928
  closePopover();
1911
1929
  setValue(value);
@@ -4725,6 +4743,7 @@ var init_useEditOrderEntry = __esm({
4725
4743
  side: order.side,
4726
4744
  reduce_only: order.reduce_only,
4727
4745
  order_type: orderType,
4746
+ margin_mode: order.margin_mode,
4728
4747
  // TODO: trailing stop order edit price twice, order.price will be 0
4729
4748
  order_price: order.price || void 0,
4730
4749
  order_quantity: order.quantity,
@@ -4785,7 +4804,10 @@ var init_useEditOrderEntry = __esm({
4785
4804
  });
4786
4805
  function useEditOrderMaxQty(order, positionQty) {
4787
4806
  const { reduce_only } = order;
4788
- const maxQty = orderlyHooks.useMaxQty(order.symbol, order.side, reduce_only);
4807
+ const maxQty = orderlyHooks.useMaxQty(order.symbol, order.side, {
4808
+ reduceOnly: reduce_only,
4809
+ marginMode: order.margin_mode ?? orderlyTypes.MarginMode.CROSS
4810
+ });
4789
4811
  return React2.useMemo(() => {
4790
4812
  if (reduce_only) {
4791
4813
  return Math.abs(positionQty ?? 0);