@orderly.network/ui-tpsl 2.12.0 → 2.12.1

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.mjs CHANGED
@@ -1356,9 +1356,10 @@ var useTPSLBuilder = (options) => {
1356
1356
  const [needConfirm] = useLocalStorage("orderly_order_confirm", true);
1357
1357
  const { marginMode: symbolMarginMode } = useMarginModeBySymbol(symbol);
1358
1358
  const [{ rows: positions }] = usePositionStream();
1359
- const mainAccountPosition = positions.find(
1360
- (item) => item.symbol === symbol && item.margin_mode === (options.position?.margin_mode ?? symbolMarginMode)
1361
- );
1359
+ const mainAccountPosition = positions.find((item) => {
1360
+ const marginMode = options.position?.margin_mode ?? symbolMarginMode;
1361
+ return item.symbol === symbol && item.margin_mode === marginMode;
1362
+ });
1362
1363
  const isSubAccount = options.position?.account_id && options.position?.account_id !== state.mainAccountId;
1363
1364
  const position = isSubAccount ? options.position : mainAccountPosition;
1364
1365
  const estLiqPrice = useEstLiqPriceBySymbol(
@@ -1408,7 +1409,6 @@ var useTPSLBuilder = (options) => {
1408
1409
  });
1409
1410
  const isSlPriceWarning = slPriceError?.sl_trigger_price?.type === ERROR_MSG_CODES.SL_PRICE_WARNING;
1410
1411
  const setQuantity = (value) => {
1411
- console.log("------>>>>>setQuantity", value);
1412
1412
  setValue("quantity", value);
1413
1413
  };
1414
1414
  const setOrderPrice = (name, value) => {
@@ -2929,9 +2929,8 @@ registerSimpleSheet(TPSLDetailSheetId, TPSLDetailWidget, {
2929
2929
  }
2930
2930
  });
2931
2931
  var useTPSLSimpleDialog = (options) => {
2932
- const { type, triggerPrice, symbol } = options;
2932
+ const { type, triggerPrice, symbol, marginMode } = options;
2933
2933
  const symbolInfo = useSymbolsInfo();
2934
- const { marginMode } = useMarginModeBySymbol(symbol ?? "");
2935
2934
  const [{ rows: positions }, positionsInfo] = usePositionStream(symbol);
2936
2935
  const position = positions?.find((item) => item.margin_mode === marginMode);
2937
2936
  useRef(AlgoOrderRootType.TP_SL);
@@ -3243,7 +3242,6 @@ var TPSLSimpleDialogUI = (props) => {
3243
3242
  var TPSLSimpleDialogWidget = (props) => {
3244
3243
  const { close, onComplete, showAdvancedTPSLDialog } = props;
3245
3244
  const state = useTPSLSimpleDialog(props);
3246
- console.log("------>>>>>TPSLSimpleDialogWidget", state);
3247
3245
  return /* @__PURE__ */ jsx(
3248
3246
  TPSLSimpleDialogUI,
3249
3247
  {