chore(trading): use quantum for liquidity supplied (#5099)
This commit is contained in:
parent
ae02b153f8
commit
20e1522088
@ -86,6 +86,7 @@ export const MarketHeaderStats = ({ market }: MarketHeaderStatsProps) => {
|
||||
<MarketLiquiditySupplied
|
||||
marketId={market.id}
|
||||
assetDecimals={asset?.decimals || 0}
|
||||
quantum={asset.quantum}
|
||||
/>
|
||||
{market.tradableInstrument.instrument.product.__typename === 'Future' && (
|
||||
<HeaderStat
|
||||
|
@ -18,7 +18,7 @@ import BigNumber from 'bignumber.js';
|
||||
import { useCheckLiquidityStatus } from '@vegaprotocol/liquidity';
|
||||
import { AuctionTrigger, MarketTradingMode } from '@vegaprotocol/types';
|
||||
import {
|
||||
addDecimalsFormatNumber,
|
||||
addDecimalsFormatNumberQuantum,
|
||||
formatNumberPercentage,
|
||||
} from '@vegaprotocol/utils';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
@ -30,12 +30,14 @@ interface Props {
|
||||
marketId?: string;
|
||||
noUpdate?: boolean;
|
||||
assetDecimals: number;
|
||||
quantum: string;
|
||||
}
|
||||
|
||||
export const MarketLiquiditySupplied = ({
|
||||
marketId,
|
||||
assetDecimals,
|
||||
noUpdate = false,
|
||||
quantum,
|
||||
}: Props) => {
|
||||
const [market, setMarket] = useState<MarketData>();
|
||||
const { params } = useNetworkParams([
|
||||
@ -79,11 +81,12 @@ export const MarketLiquiditySupplied = ({
|
||||
});
|
||||
|
||||
const supplied = market?.suppliedStake
|
||||
? addDecimalsFormatNumber(
|
||||
? addDecimalsFormatNumberQuantum(
|
||||
new BigNumber(market?.suppliedStake)
|
||||
.multipliedBy(stakeToCcyVolume || 1)
|
||||
.toString(),
|
||||
assetDecimals
|
||||
assetDecimals,
|
||||
quantum
|
||||
)
|
||||
: '-';
|
||||
|
||||
@ -108,9 +111,10 @@ export const MarketLiquiditySupplied = ({
|
||||
<span>{t('Supplied stake')}</span>
|
||||
<span>
|
||||
{market?.suppliedStake
|
||||
? addDecimalsFormatNumber(
|
||||
new BigNumber(market?.suppliedStake).toString(),
|
||||
assetDecimals
|
||||
? addDecimalsFormatNumberQuantum(
|
||||
market?.suppliedStake,
|
||||
assetDecimals,
|
||||
quantum
|
||||
)
|
||||
: '-'}
|
||||
</span>
|
||||
@ -119,9 +123,10 @@ export const MarketLiquiditySupplied = ({
|
||||
<span>{t('Target stake')}</span>
|
||||
<span>
|
||||
{market?.targetStake
|
||||
? addDecimalsFormatNumber(
|
||||
new BigNumber(market?.targetStake).toString(),
|
||||
assetDecimals
|
||||
? addDecimalsFormatNumberQuantum(
|
||||
market?.targetStake,
|
||||
assetDecimals,
|
||||
quantum
|
||||
)
|
||||
: '-'}
|
||||
</span>
|
||||
|
@ -43,7 +43,7 @@ import {
|
||||
REDUCE_ONLY_TOOLTIP,
|
||||
stopSubmit,
|
||||
getNotionalSize,
|
||||
getAssetUnit,
|
||||
getBaseQuoteUnit,
|
||||
} from './deal-ticket';
|
||||
import { TypeToggle } from './type-selector';
|
||||
import {
|
||||
@ -854,7 +854,7 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
|
||||
}, [watch, market.id, updateStoredFormValues]);
|
||||
|
||||
const quoteName = getQuoteName(market);
|
||||
const assetUnit = getAssetUnit(
|
||||
const assetUnit = getBaseQuoteUnit(
|
||||
market.tradableInstrument.instrument.metadata.tags
|
||||
);
|
||||
|
||||
|
@ -127,7 +127,7 @@ const getDefaultValues = (
|
||||
...storedValues,
|
||||
});
|
||||
|
||||
export const getAssetUnit = (tags?: string[] | null) =>
|
||||
export const getBaseQuoteUnit = (tags?: string[] | null) =>
|
||||
tags
|
||||
?.find((tag) => tag.startsWith('base:') || tag.startsWith('ticker:'))
|
||||
?.replace(/^[^:]*:/, '');
|
||||
@ -273,9 +273,7 @@ export const DealTicket = ({
|
||||
|
||||
const assetSymbol = getAsset(market).symbol;
|
||||
|
||||
const assetUnit = getAssetUnit(
|
||||
market.tradableInstrument.instrument.metadata.tags
|
||||
);
|
||||
const assetUnit = getQuoteName(market);
|
||||
|
||||
const summaryError = useMemo(() => {
|
||||
if (!pubKey) {
|
||||
|
Loading…
Reference in New Issue
Block a user