feat(trading): update submit on TP and SL

This commit is contained in:
Madalina Raicu 2024-03-05 15:58:04 +00:00
parent 4b4f9af8d6
commit 5752b5b089
No known key found for this signature in database
GPG Key ID: 688B7B31149C1DCD
2 changed files with 8 additions and 22 deletions

View File

@ -12,17 +12,12 @@ import {
Pill,
} from '@vegaprotocol/ui-toolkit';
import { useT } from '../../use-t';
import { type Side } from '@vegaprotocol/types';
export interface DealTicketPriceTakeProfitStopLossProps {
control: Control<OrderFormValues>;
market: Market;
takeProfitError?: string;
stopLossError?: string;
setPrice?: string;
takeProfit?: string;
stopLoss?: string;
side?: Side;
quoteName?: string;
}
@ -32,10 +27,6 @@ export const DealTicketPriceTakeProfitStopLoss = ({
takeProfitError,
stopLossError,
quoteName,
setPrice,
takeProfit,
stopLoss,
side,
}: DealTicketPriceTakeProfitStopLossProps) => {
const t = useT();
const validateAmount = useValidateAmount();

View File

@ -193,8 +193,6 @@ export const DealTicket = ({
const peakSize = watch('peakSize');
const expiresAt = watch('expiresAt');
const postOnly = watch('postOnly');
const takeProfit = watch('takeProfit');
const stopLoss = watch('stopLoss');
useEffect(() => {
const size = storedFormValues?.[dealTicketType]?.size;
@ -400,14 +398,15 @@ export const DealTicket = ({
submit({
batchMarketInstructions,
});
} else {
const orderSubmission = mapFormValuesToOrderSubmission(
formValues,
market.id,
market.decimalPlaces,
market.positionDecimalPlaces
);
submit({ orderSubmission });
}
const orderSubmission = mapFormValuesToOrderSubmission(
formValues,
market.id,
market.decimalPlaces,
market.positionDecimalPlaces
);
submit({ orderSubmission });
lastSubmitTime.current = now;
},
[market, pubKey, submit]
@ -764,10 +763,6 @@ export const DealTicket = ({
takeProfitError={errors.takeProfit?.message}
stopLossError={errors.stopLoss?.message}
control={control}
setPrice={price}
takeProfit={takeProfit}
stopLoss={stopLoss}
side={side}
quoteName={quoteName}
/>
)}