chore: remove helpers only used by lp dashboard
This commit is contained in:
parent
62cb12001a
commit
1b8892c445
@ -2,7 +2,6 @@ import { renderHook } from '@testing-library/react';
|
|||||||
import { Intent } from '@vegaprotocol/ui-toolkit';
|
import { Intent } from '@vegaprotocol/ui-toolkit';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import {
|
import {
|
||||||
formatWithAsset,
|
|
||||||
sumLiquidityCommitted,
|
sumLiquidityCommitted,
|
||||||
getFeeLevels,
|
getFeeLevels,
|
||||||
calcDayVolume,
|
calcDayVolume,
|
||||||
@ -23,17 +22,6 @@ const CANDLES_2 = [
|
|||||||
{ volume: '10', open: '21', close: '21' },
|
{ volume: '10', open: '21', close: '21' },
|
||||||
];
|
];
|
||||||
|
|
||||||
describe('formatWithAsset', () => {
|
|
||||||
it('should return formatted string', () => {
|
|
||||||
const result = formatWithAsset('103926176181', {
|
|
||||||
decimals: 5,
|
|
||||||
symbol: 'tEURO',
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result).toEqual('1,039,261.76181 tEURO');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('sumLiquidityCommitted', () => {
|
describe('sumLiquidityCommitted', () => {
|
||||||
it('should return the total sum', () => {
|
it('should return the total sum', () => {
|
||||||
const provider1 = 10;
|
const provider1 = 10;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
|
||||||
|
|
||||||
import type { MarketNodeFragment } from './../__generated__/MarketsLiquidity';
|
import type { MarketNodeFragment } from './../__generated__/MarketsLiquidity';
|
||||||
import { Intent } from '@vegaprotocol/ui-toolkit';
|
import { Intent } from '@vegaprotocol/ui-toolkit';
|
||||||
@ -21,20 +20,6 @@ export const sumLiquidityCommitted = (
|
|||||||
: 0;
|
: 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formatWithAsset = (
|
|
||||||
value: string,
|
|
||||||
settlementAsset: {
|
|
||||||
decimals?: number;
|
|
||||||
symbol?: string;
|
|
||||||
}
|
|
||||||
) => {
|
|
||||||
const { decimals, symbol } = settlementAsset;
|
|
||||||
const formattedValue = decimals
|
|
||||||
? addDecimalsFormatNumber(value, decimals)
|
|
||||||
: value;
|
|
||||||
return `${formattedValue} ${symbol}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
interface Candle {
|
interface Candle {
|
||||||
open: string;
|
open: string;
|
||||||
close: string;
|
close: string;
|
||||||
@ -48,10 +33,6 @@ export const getCandle24hAgo = (
|
|||||||
return candles24hAgo.find((c) => c.marketId === marketId)?.candles?.[0];
|
return candles24hAgo.find((c) => c.marketId === marketId)?.candles?.[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const displayChange = (value: string) => {
|
|
||||||
return parseFloat(value) > 0 ? `+${value}` : value;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const EMPTY_VALUE = ' - ';
|
export const EMPTY_VALUE = ' - ';
|
||||||
export const getChange = (candles: (Candle | null)[], lastClose?: string) => {
|
export const getChange = (candles: (Candle | null)[], lastClose?: string) => {
|
||||||
const firstCandle = candles.find((item) => item?.open);
|
const firstCandle = candles.find((item) => item?.open);
|
||||||
|
Loading…
Reference in New Issue
Block a user