* fix(#2530): fix use order close out - formatting to be done in component * fix: format number in console-lite
This commit is contained in:
parent
13ab03c459
commit
31ffa306eb
@ -83,10 +83,11 @@ export const DealTicketSteps = ({ market }: DealTicketMarketProps) => {
|
||||
order,
|
||||
});
|
||||
|
||||
const estCloseOut = useOrderCloseOut({
|
||||
const closeOut = useOrderCloseOut({
|
||||
order,
|
||||
market,
|
||||
});
|
||||
const estCloseOut = closeOut && formatNumber(closeOut, market.decimalPlaces);
|
||||
const slippage = useCalculateSlippage({ marketId: market.id, order });
|
||||
const [slippageValue, setSlippageValue] = useState(
|
||||
slippage ? parseFloat(slippage) : 0
|
||||
|
@ -71,7 +71,7 @@ describe('useOrderCloseOut', () => {
|
||||
wrapper: MockedProvider,
|
||||
}
|
||||
);
|
||||
expect(result.current).toEqual('1.00');
|
||||
expect(result.current).toEqual('1');
|
||||
});
|
||||
|
||||
it('should return proper empty value', () => {
|
||||
@ -88,6 +88,6 @@ describe('useOrderCloseOut', () => {
|
||||
wrapper: MockedProvider,
|
||||
}
|
||||
);
|
||||
expect(result.current).toEqual('0.00');
|
||||
expect(result.current).toEqual('0');
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||
import { addDecimal, formatNumber } from '@vegaprotocol/react-helpers';
|
||||
import { addDecimal } from '@vegaprotocol/react-helpers';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
||||
import {
|
||||
@ -49,7 +49,7 @@ export const useOrderCloseOut = ({ order, market }: Props): string | null => {
|
||||
.minus(generalAccountBalance);
|
||||
const closeOut = marginDifference.div(volume).plus(markPrice);
|
||||
if (closeOut.isPositive()) {
|
||||
return formatNumber(closeOut, market.decimalPlaces);
|
||||
return closeOut.toString();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user