* 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,
|
order,
|
||||||
});
|
});
|
||||||
|
|
||||||
const estCloseOut = useOrderCloseOut({
|
const closeOut = useOrderCloseOut({
|
||||||
order,
|
order,
|
||||||
market,
|
market,
|
||||||
});
|
});
|
||||||
|
const estCloseOut = closeOut && formatNumber(closeOut, market.decimalPlaces);
|
||||||
const slippage = useCalculateSlippage({ marketId: market.id, order });
|
const slippage = useCalculateSlippage({ marketId: market.id, order });
|
||||||
const [slippageValue, setSlippageValue] = useState(
|
const [slippageValue, setSlippageValue] = useState(
|
||||||
slippage ? parseFloat(slippage) : 0
|
slippage ? parseFloat(slippage) : 0
|
||||||
|
@ -71,7 +71,7 @@ describe('useOrderCloseOut', () => {
|
|||||||
wrapper: MockedProvider,
|
wrapper: MockedProvider,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
expect(result.current).toEqual('1.00');
|
expect(result.current).toEqual('1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return proper empty value', () => {
|
it('should return proper empty value', () => {
|
||||||
@ -88,6 +88,6 @@ describe('useOrderCloseOut', () => {
|
|||||||
wrapper: MockedProvider,
|
wrapper: MockedProvider,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
expect(result.current).toEqual('0.00');
|
expect(result.current).toEqual('0');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { BigNumber } from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
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 * as Schema from '@vegaprotocol/types';
|
||||||
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
||||||
import {
|
import {
|
||||||
@ -49,7 +49,7 @@ export const useOrderCloseOut = ({ order, market }: Props): string | null => {
|
|||||||
.minus(generalAccountBalance);
|
.minus(generalAccountBalance);
|
||||||
const closeOut = marginDifference.div(volume).plus(markPrice);
|
const closeOut = marginDifference.div(volume).plus(markPrice);
|
||||||
if (closeOut.isPositive()) {
|
if (closeOut.isPositive()) {
|
||||||
return formatNumber(closeOut, market.decimalPlaces);
|
return closeOut.toString();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user