* fix(#2538): stakeToCcyVolume param * chore: fix for network params query error Co-authored-by: Rado <szpiechrados@gmail.com>
This commit is contained in:
parent
5b42a6ad35
commit
dabae31bfd
@ -14,6 +14,7 @@ import {
|
||||
|
||||
describe('Portfolio page - wallet', { tags: '@smoke' }, () => {
|
||||
it('button for wallet connect should work', () => {
|
||||
cy.mockConsole();
|
||||
cy.visit('/');
|
||||
cy.get('[href="/portfolio"]').eq(0).click();
|
||||
cy.getByTestId('trading-connect-wallet').should('be.visible');
|
||||
@ -57,17 +58,8 @@ describe('Portfolio page tabs', { tags: '@smoke' }, () => {
|
||||
});
|
||||
|
||||
describe('Assets view', () => {
|
||||
before(() => {
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'ChainId', chainIdQuery());
|
||||
aliasGQLQuery(req, 'Statistics', statisticsQuery());
|
||||
aliasGQLQuery(req, 'Positions', positionsQuery());
|
||||
aliasGQLQuery(req, 'Margins', marginsQuery());
|
||||
aliasGQLQuery(req, 'Markets', marketsQuery());
|
||||
aliasGQLQuery(req, 'MarketsData', marketsDataQuery());
|
||||
aliasGQLQuery(req, 'Accounts', accountsQuery());
|
||||
aliasGQLQuery(req, 'Assets', assetsQuery());
|
||||
});
|
||||
beforeEach(() => {
|
||||
cy.mockConsole();
|
||||
cy.setVegaWallet();
|
||||
cy.visit('/portfolio/assets');
|
||||
});
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
marketsCandlesQuery,
|
||||
marketsDataQuery,
|
||||
marketsQuery,
|
||||
networkParamsQuery,
|
||||
ordersQuery,
|
||||
positionsQuery,
|
||||
statisticsQuery,
|
||||
@ -47,6 +48,7 @@ const mockPage = (req: CyHttpMessages.IncomingHttpRequest) => {
|
||||
aliasGQLQuery(req, 'SimpleMarkets', marketsQuery());
|
||||
aliasGQLQuery(req, 'Orders', ordersQuery());
|
||||
aliasGQLQuery(req, 'Fills', fillsQuery());
|
||||
aliasGQLQuery(req, 'NetworkParams', networkParamsQuery());
|
||||
};
|
||||
|
||||
export const addMockConsole = () => {
|
||||
|
@ -29,7 +29,7 @@
|
||||
"market.liquidity.maximumLiquidityFeeFactorLevel",
|
||||
"market.liquidity.minimum.probabilityOfTrading.lpOrders",
|
||||
"market.liquidity.probabilityOfTrading.tau.scaling",
|
||||
"market.liquidity.stakeToCcySiskas",
|
||||
"market.liquidity.stakeToCcyVolume",
|
||||
"market.liquidity.targetstake.triggering.ratio",
|
||||
"market.liquidityProvision.minLpStakeQuantumMultiple",
|
||||
"market.liquidityProvision.shapes.maxSize",
|
||||
|
@ -1,16 +1,11 @@
|
||||
import { aliasGQLQuery } from '@vegaprotocol/cypress';
|
||||
import {
|
||||
assetsQuery,
|
||||
ledgerEntriesQuery,
|
||||
marketsQuery,
|
||||
} from '@vegaprotocol/mock';
|
||||
import { ledgerEntriesQuery } from '@vegaprotocol/mock';
|
||||
|
||||
describe('Portfolio page', { tags: '@smoke' }, () => {
|
||||
beforeEach(() => {
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'LedgerEntries', ledgerEntriesQuery());
|
||||
aliasGQLQuery(req, 'Assets', assetsQuery());
|
||||
aliasGQLQuery(req, 'Markets', marketsQuery());
|
||||
});
|
||||
cy.mockSubscription();
|
||||
cy.setVegaWallet();
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
NetworkParams,
|
||||
t,
|
||||
useDataProvider,
|
||||
useNetworkParam,
|
||||
useNetworkParams,
|
||||
} from '@vegaprotocol/react-helpers';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
import {
|
||||
@ -91,11 +91,10 @@ export const LiquidityContainer = ({
|
||||
marketProvision?.market?.tradableInstrument.instrument.product
|
||||
.settlementAsset.symbol;
|
||||
|
||||
const { param: stakeToCcySiskas } = useNetworkParam(
|
||||
NetworkParams.market_liquidity_stakeToCcySiskas
|
||||
);
|
||||
const stakeToCcySiska = stakeToCcySiskas && stakeToCcySiskas[0];
|
||||
|
||||
const { params } = useNetworkParams([
|
||||
NetworkParams.market_liquidity_stakeToCcyVolume,
|
||||
]);
|
||||
const stakeToCcyVolume = params.market_liquidity_stakeToCcyVolume;
|
||||
const filteredEdges = useMemo(
|
||||
() =>
|
||||
liquidityProviders?.filter((e) =>
|
||||
@ -115,7 +114,7 @@ export const LiquidityContainer = ({
|
||||
data={filteredEdges}
|
||||
symbol={symbol}
|
||||
assetDecimalPlaces={assetDecimalPlaces}
|
||||
stakeToCcySiskas={stakeToCcySiska}
|
||||
stakeToCcyVolume={stakeToCcyVolume}
|
||||
/>
|
||||
</AsyncRenderer>
|
||||
);
|
||||
@ -180,11 +179,10 @@ export const LiquidityViewContainer = ({
|
||||
marketProvision?.market?.tradableInstrument.instrument.product
|
||||
.settlementAsset.symbol;
|
||||
|
||||
const { param: stakeToCcySiskas } = useNetworkParam(
|
||||
NetworkParams.market_liquidity_stakeToCcySiskas
|
||||
);
|
||||
const stakeToCcySiska = stakeToCcySiskas && stakeToCcySiskas[0];
|
||||
|
||||
const { params } = useNetworkParams([
|
||||
NetworkParams.market_liquidity_stakeToCcyVolume,
|
||||
]);
|
||||
const stakeToCcyVolume = params.market_liquidity_stakeToCcyVolume;
|
||||
const myLpEdges = useMemo(
|
||||
() => liquidityProviders?.filter((e) => e.party.id === pubKey),
|
||||
[liquidityProviders, pubKey]
|
||||
@ -279,7 +277,7 @@ export const LiquidityViewContainer = ({
|
||||
ref={gridRef}
|
||||
data={myLpEdges}
|
||||
symbol={symbol}
|
||||
stakeToCcySiskas={stakeToCcySiska}
|
||||
stakeToCcyVolume={stakeToCcyVolume}
|
||||
assetDecimalPlaces={assetDecimalPlaces}
|
||||
/>
|
||||
)}
|
||||
@ -291,7 +289,7 @@ export const LiquidityViewContainer = ({
|
||||
data={activeEdges}
|
||||
symbol={symbol}
|
||||
assetDecimalPlaces={assetDecimalPlaces}
|
||||
stakeToCcySiskas={stakeToCcySiska}
|
||||
stakeToCcyVolume={stakeToCcyVolume}
|
||||
/>
|
||||
)}
|
||||
</Tab>
|
||||
@ -303,7 +301,7 @@ export const LiquidityViewContainer = ({
|
||||
data={inactiveEdges}
|
||||
symbol={symbol}
|
||||
assetDecimalPlaces={assetDecimalPlaces}
|
||||
stakeToCcySiskas={stakeToCcySiska}
|
||||
stakeToCcyVolume={stakeToCcyVolume}
|
||||
/>
|
||||
)}
|
||||
</Tab>
|
||||
|
@ -32,11 +32,11 @@ export const MarketLiquiditySupplied = ({
|
||||
}: Props) => {
|
||||
const [market, setMarket] = useState<MarketData>();
|
||||
const { params } = useNetworkParams([
|
||||
NetworkParams.market_liquidity_stakeToCcySiskas,
|
||||
NetworkParams.market_liquidity_stakeToCcyVolume,
|
||||
NetworkParams.market_liquidity_targetstake_triggering_ratio,
|
||||
]);
|
||||
|
||||
const stakeToCcyVolume = Number(params.market_liquidity_stakeToCcySiskas);
|
||||
const stakeToCcyVolume = params.market_liquidity_stakeToCcyVolume;
|
||||
const triggeringRatio = Number(
|
||||
params.market_liquidity_targetstake_triggering_ratio
|
||||
);
|
||||
|
@ -22,7 +22,7 @@ describe('LiquidityTable', () => {
|
||||
it('should render successfully', async () => {
|
||||
await act(async () => {
|
||||
const { baseElement } = render(
|
||||
<LiquidityTable data={[]} stakeToCcySiskas={'1'} />
|
||||
<LiquidityTable data={[]} stakeToCcyVolume={'1'} />
|
||||
);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
@ -30,7 +30,7 @@ describe('LiquidityTable', () => {
|
||||
|
||||
it('should render correct columns', async () => {
|
||||
await act(async () => {
|
||||
render(<LiquidityTable data={singleRowData} stakeToCcySiskas={'0.3'} />);
|
||||
render(<LiquidityTable data={singleRowData} stakeToCcyVolume={'0.3'} />);
|
||||
});
|
||||
|
||||
const headers = await screen.getAllByRole('columnheader');
|
||||
|
@ -34,11 +34,11 @@ export interface LiquidityTableProps {
|
||||
data?: LiquidityProvisionData[];
|
||||
symbol?: string;
|
||||
assetDecimalPlaces?: number;
|
||||
stakeToCcySiskas: string | null;
|
||||
stakeToCcyVolume: string | null;
|
||||
}
|
||||
|
||||
export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
|
||||
({ data, symbol = '', assetDecimalPlaces, stakeToCcySiskas }, ref) => {
|
||||
({ data, symbol = '', assetDecimalPlaces, stakeToCcyVolume }, ref) => {
|
||||
const assetDecimalsFormatter = ({ value }: ValueFormatterParams) => {
|
||||
if (!value) return '-';
|
||||
return `${addDecimalsFormatNumber(value, assetDecimalPlaces ?? 0, 5)}`;
|
||||
@ -46,7 +46,7 @@ export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
|
||||
const stakeToCcyVolumeFormatter = ({ value }: ValueFormatterParams) => {
|
||||
if (!value) return '-';
|
||||
const newValue = new BigNumber(value)
|
||||
.times(Number(stakeToCcySiskas) || 1)
|
||||
.times(Number(stakeToCcyVolume) || 1)
|
||||
.toString();
|
||||
return `${addDecimalsFormatNumber(newValue, assetDecimalPlaces ?? 0, 5)}`;
|
||||
};
|
||||
|
@ -101,7 +101,6 @@ export const NetworkParams = {
|
||||
validators_delegation_minAmount: 'validators_delegation_minAmount',
|
||||
spam_protection_voting_min_tokens: 'spam_protection_voting_min_tokens',
|
||||
spam_protection_proposal_min_tokens: 'spam_protection_proposal_min_tokens',
|
||||
market_liquidity_stakeToCcySiskas: 'market_liquidity_stakeToCcySiskas',
|
||||
market_liquidity_stakeToCcyVolume: 'market_liquidity_stakeToCcyVolume',
|
||||
market_liquidity_targetstake_triggering_ratio:
|
||||
'market_liquidity_targetstake_triggering_ratio',
|
||||
|
Loading…
Reference in New Issue
Block a user